当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Editor.Editor类代码示例

本文整理汇总了TypeScript中tinymce/core/api/Editor.Editor的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor类的具体用法?TypeScript Editor怎么用?TypeScript Editor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Editor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: listsIndentation

const selectionIndentation = (editor: Editor, indentation: Indentation): boolean => {
  const lists = Arr.map(Selection.getSelectedListRoots(editor), Element.fromDom);
  const dlItems = Arr.map(Selection.getSelectedDlItems(editor), Element.fromDom);
  let isHandled = false;

  if (lists.length || dlItems.length) {
    const bookmark = editor.selection.getBookmark();

    listsIndentation(editor, lists, indentation);
    dlIndentation(editor, indentation, dlItems);

    editor.selection.moveToBookmark(bookmark);
    editor.selection.setRng(Range.normalizeRange(editor.selection.getRng()));
    editor.nodeChanged();
    isHandled = true;
  }

  return isHandled;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:19,代码来源:Indendation.ts

示例2: getContentEditableRoot

    editor.on('mousedown', (e: MouseEvent) => {
      let contentEditableRoot;
      const targetElm = e.target as Element;

      if (targetElm !== rootNode && targetElm.nodeName !== 'HTML' && !editor.dom.isChildOf(targetElm, rootNode)) {
        return;
      }

      if (EditorView.isXYInContentArea(editor, e.clientX, e.clientY) === false) {
        return;
      }

      contentEditableRoot = getContentEditableRoot(targetElm);
      if (contentEditableRoot) {
        if (isContentEditableFalse(contentEditableRoot)) {
          e.preventDefault();
          setContentEditableSelection(CefUtils.selectNode(editor, contentEditableRoot));
        } else {
          removeContentEditableSelection();

          // Check that we're not attempting a shift + click select within a contenteditable='true' element
          if (!(isContentEditableTrue(contentEditableRoot) && e.shiftKey) && !RangePoint.isXYWithinRange(e.clientX, e.clientY, editor.selection.getRng())) {
            editor.selection.placeCaretAt(e.clientX, e.clientY);
          }
        }
      } else if (isFakeCaretTarget(targetElm) === false) {
        // Remove needs to be called here since the mousedown might alter the selection without calling selection.setRng
        // and therefore not fire the AfterSetSelectionRange event.
        removeContentEditableSelection();
        hideFakeCaret();

        const caretInfo = LineUtils.closestCaret(rootNode, e.clientX, e.clientY);
        if (caretInfo) {
          if (!hasBetterMouseTarget(e.target, caretInfo.node)) {
            e.preventDefault();
            const range = showCaret(1, caretInfo.node as HTMLElement, caretInfo.before, false);
            editor.getBody().focus();
            setRange(range);
          }
        }
      }
    });
开发者ID:abstask,项目名称:tinymce,代码行数:42,代码来源:SelectionOverrides.ts

示例3: dlIndentation

const selectionIndentation = (editor: Editor, indentation: IndentValue) => {
  const dlItems = Arr.map(Selection.getSelectedDlItems(editor), Element.fromDom);
  const lists = Arr.map(Selection.getSelectedListRoots(editor), Element.fromDom);

  if (dlItems.length || lists.length) {
    const bookmark = editor.selection.getBookmark();

    dlIndentation(editor, indentation, dlItems);

    listsIndentation(
      editor,
      lists,
      indentation
    );

    editor.selection.moveToBookmark(bookmark);
    editor.selection.setRng(Range.normalizeRange(editor.selection.getRng()));
    editor.nodeChanged();
  }
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:20,代码来源:Indendation.ts

示例4: function

const findSpansByIndex = function (editor: Editor, index: string) {
  let nodes;
  const spans = [];

  nodes = Tools.toArray(editor.getBody().getElementsByTagName('span'));
  if (nodes.length) {
    for (let i = 0; i < nodes.length; i++) {
      const nodeIndex = getElmIndex(nodes[i]);

      if (nodeIndex === null || !nodeIndex.length) {
        continue;
      }

      if (nodeIndex === index.toString()) {
        spans.push(nodes[i]);
      }
    }
  }

  return spans;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:21,代码来源:Actions.ts

示例5: function

    editor.on('click', function (e) {
      let contentEditableRoot;

      contentEditableRoot = getContentEditableRoot(editor, e.target);
      if (contentEditableRoot) {
        // Prevent clicks on links in a cE=false element
        if (isContentEditableFalse(contentEditableRoot)) {
          e.preventDefault();
          editor.focus();
        }

        // Removes fake selection if a cE=true is clicked within a cE=false like the toc title
        if (isContentEditableTrue(contentEditableRoot)) {
          if (editor.dom.isChildOf(contentEditableRoot, editor.selection.getNode())) {
            removeContentEditableSelection();
          }
        }
      }
    });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:19,代码来源:SelectionOverrides.ts

示例6:

  const showCaret = (direction: number, node: Element, before: boolean, scrollIntoView: boolean = true): Range => {
    let e;

    e = editor.fire('ShowCaret', {
      target: node,
      direction,
      before
    });

    if (e.isDefaultPrevented()) {
      return null;
    }

    if (scrollIntoView) {
      editor.selection.scrollIntoView(node, direction === -1);
    }

    return fakeCaret.show(before, node);
  };
开发者ID:nyroDev,项目名称:tinymce,代码行数:19,代码来源:SelectionOverrides.ts

示例7: func

  const queryCommandValue = function (command) {
    let func;

    if (editor.quirks.isHidden() || editor.removed) {
      return;
    }

    command = command.toLowerCase();
    if ((func = commands.value[command])) {
      return func(command);
    }

    // Browser commands
    try {
      return editor.getDoc().queryCommandValue(command);
    } catch (ex) {
      // Fails sometimes see bug: 1896577
    }
  };
开发者ID:nyroDev,项目名称:tinymce,代码行数:19,代码来源:EditorCommands.ts

示例8: function

  const isResizable = function (elm) {
    let selector = editor.settings.object_resizing;

    if (selector === false || Env.iOS) {
      return false;
    }

    if (typeof selector !== 'string') {
      selector = 'table,img,figure.image,div';
    }

    if (elm.getAttribute('data-mce-resize') === 'false') {
      return false;
    }

    if (elm === editor.getBody()) {
      return false;
    }

    return Selectors.is(SugarElement.fromDom(elm), selector);
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:21,代码来源:ControlSelection.ts

示例9: function

 return function (table, target) {
   Util.removeDataStyle(table);
   const wire = lazyWire();
   const doc = Element.fromDom(editor.getDoc());
   const direction = TableDirection(Direction.directionAt);
   const generators = TableFill.cellOperations(mutate, doc, cloneFormats);
   return guard(table) ? operation(wire, table, target, generators, direction).bind(function (result) {
     Arr.each(result.newRows(), function (row) {
       fireNewRow(editor, row.dom());
     });
     Arr.each(result.newCells(), function (cell) {
       fireNewCell(editor, cell.dom());
     });
     return result.cursor().map(function (cell) {
       const rng = editor.dom.createRng();
       rng.setStart(cell.dom(), 0);
       rng.setEnd(cell.dom(), 0);
       return rng;
     });
   }) : Option.none();
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:21,代码来源:TableActions.ts

示例10: function

  editor.undoManager.transact(function () {
    Tools.each(cells, function (cellElm: HTMLTableCellElement) {
      setAttrib(cellElm, 'scope', data.scope);

      if (cells.length === 1) {
        setAttrib(cellElm, 'style', data.style);
      } else {
        updateStyles(cellElm, data.style);
      }

      setAttrib(cellElm, 'class', data.class);
      setStyle(cellElm, 'width', Util.addSizeSuffix(data.width));
      setStyle(cellElm, 'height', Util.addSizeSuffix(data.height));

      // Switch cell type
      if (data.type && cellElm.nodeName.toLowerCase() !== data.type) {
        cellElm = dom.rename(cellElm, data.type) as HTMLTableCellElement;
      }

      // Remove alignment
      if (cells.length === 1) {
        Styles.unApplyAlign(editor, cellElm);
        Styles.unApplyVAlign(editor, cellElm);
      }

      // Apply alignment
      if (data.align) {
        Styles.applyAlign(editor, cellElm, data.align);
      }

      // Apply vertical alignment
      if (data.valign) {
        Styles.applyVAlign(editor, cellElm, data.valign);
      }
    });

    editor.focus();
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:38,代码来源:CellDialog.ts


注:本文中的tinymce/core/api/Editor.Editor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。