How to use the editor.ElementPath function in editor

To help you get started, we’ve selected a few editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kissyteam / kissy / src / editor / sub-modules / plugin / heading / sub-modules / cmd / src / cmd.js View on Github external
exec: function (editor) {
                    var selection = editor.getSelection();
                    if (selection && !selection.isInvalid) {
                        var startElement = selection.getStartElement();
                        var currentPath = new Editor.ElementPath(startElement);
                        var block = currentPath.block || currentPath.blockLimit;
                        var nodeName = block && block.nodeName() || '';
                        if (nodeName.match(/^h\d$/) || nodeName === 'p') {
                            return nodeName;
                        }
                    }
                }
            });
github kissyteam / kissy / build / editor / plugin / font / cmd-debug.js View on Github external
exec: function (editor) {
                        var selection = editor.getSelection();
                        if (selection && !selection.isInvalid) {
                            var startElement = selection.getStartElement(), currentPath = new Editor.ElementPath(startElement);
                            return style.checkActive(currentPath);
                        }
                    }
                });
github kissyteam / kissy / src / editor / sub-modules / plugin / outdent / sub-modules / cmd / src / cmd.js View on Github external
exec: function (editor) {
                    var selection = editor.getSelection();
                    if (selection && !selection.isInvalid) {
                        var startElement = selection.getStartElement();
                        var elementPath = new Editor.ElementPath(startElement);
                        return checkOutdentActive(elementPath);
                    }
                }
            });
github kissyteam / kissy / build / editor / plugin / unordered-list / cmd-debug.js View on Github external
exec: function (editor) {
                        var selection = editor.getSelection();
                        if (selection && !selection.isInvalid) {
                            var startElement = selection.getStartElement();
                            var elementPath = new Editor.ElementPath(startElement);
                            return queryActive('ul', elementPath);
                        }
                    }
                });
github kissyteam / kissy / src / editor / sub-modules / plugin / unordered-list / sub-modules / cmd / src / cmd.js View on Github external
exec: function (editor) {
                    var selection = editor.getSelection();
                    if (selection && !selection.isInvalid) {
                        var startElement = selection.getStartElement();
                        var elementPath = new Editor.ElementPath(startElement);
                        return queryActive('ul', elementPath);
                    }
                }
            });
github kissyteam / kissy / build / editor / plugin / font / cmd-debug.js View on Github external
exec: function (editor) {
                        var selection = editor.getSelection();
                        if (selection && !selection.isInvalid) {
                            var startElement = selection.getStartElement();
                            var currentPath = new Editor.ElementPath(startElement);
                            return getValueFromStyleObj(currentPath, styleObj);
                        }
                    }
                });
github kissyteam / kissy / src / editor / sub-modules / plugin / font / cmd / src / cmd.js View on Github external
exec: function (editor) {
                    var selection = editor.getSelection();
                    if (selection && !selection.isInvalid) {
                        var startElement = selection.getStartElement(),
                            currentPath = new Editor.ElementPath(startElement);
                        return  style.checkActive(currentPath);
                    }
                }
            });
github kissyteam / kissy / build / editor / plugin / heading / cmd-debug.js View on Github external
exec: function (editor) {
                        var selection = editor.getSelection();
                        if (selection && !selection.isInvalid) {
                            var startElement = selection.getStartElement();
                            var currentPath = new Editor.ElementPath(startElement);
                            var block = currentPath.block || currentPath.blockLimit;
                            var nodeName = block && block.nodeName() || '';
                            if (nodeName.match(/^h\d$/) || nodeName === 'p') {
                                return nodeName;
                            }
                        }
                    }
                });
github kissyteam / kissy / build / editor / plugin / justify-cmd.js View on Github external
editor.addCommand(Editor.Utils.getQueryCmd(command), {exec:function(editor) {
        var selection = editor.getSelection();
        if(selection && !selection.isInvalid) {
          var startElement = selection.getStartElement();
          var path = new Editor.ElementPath(startElement);
          var block = path.block || path.blockLimit;
          if(!block || block.nodeName() === "body") {
            return false
          }
          return isAlign(block, textAlign)
        }
      }})
    }
github kissyteam / kissy / src / editor / sub-modules / plugin / ordered-list / sub-modules / cmd / src / cmd.js View on Github external
exec: function (editor) {
                    var selection = editor.getSelection();
                    if (selection && !selection.isInvalid) {
                        var startElement = selection.getStartElement();
                        var elementPath = new Editor.ElementPath(startElement);
                        return queryActive('ol', elementPath);
                    }
                }
            });