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


TypeScript Editor.%24方法代码示例

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


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

示例1: function

  const replaceImageUri = function (image: HTMLImageElement, resultUri: string) {
    blobCache.removeByUri(image.src);
    replaceUrlInUndoStack(image.src, resultUri);

    editor.$(image).attr({
      'src': Settings.shouldReuseFileName(editor) ? resultUri + cacheInvalidator() : resultUri,
      'data-mce-src': editor.convertURL(resultUri, 'src')
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:EditorUpload.ts

示例2: function

  const moveSelectionToMarker = function (marker) {
    let parentEditableFalseElm, parentBlock, nextRng;

    const getContentEditableFalseParent = function (node) {
      const root = editor.getBody();

      for (; node && node !== root; node = node.parentNode) {
        if (editor.dom.getContentEditable(node) === 'false') {
          return node;
        }
      }

      return null;
    };

    if (!marker) {
      return;
    }

    selection.scrollIntoView(marker);

    // If marker is in cE=false then move selection to that element instead
    parentEditableFalseElm = getContentEditableFalseParent(marker);
    if (parentEditableFalseElm) {
      dom.remove(marker);
      selection.select(parentEditableFalseElm);
      return;
    }

    // Move selection before marker and remove it
    rng = dom.createRng();

    // If previous sibling is a text node set the selection to the end of that node
    node = marker.previousSibling;
    if (node && node.nodeType === 3) {
      rng.setStart(node, node.nodeValue.length);

      // TODO: Why can't we normalize on IE
      if (!Env.ie) {
        node2 = marker.nextSibling;
        if (node2 && node2.nodeType === 3) {
          node.appendData(node2.data);
          node2.parentNode.removeChild(node2);
        }
      }
    } else {
      // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node
      rng.setStartBefore(marker);
      rng.setEndBefore(marker);
    }

    const findNextCaretRng = function (rng) {
      let caretPos = CaretPosition.fromRangeStart(rng);
      const caretWalker = CaretWalker(editor.getBody());

      caretPos = caretWalker.next(caretPos);
      if (caretPos) {
        return caretPos.toRange();
      }
    };

    // Remove the marker node and set the new range
    parentBlock = dom.getParent(marker, dom.isBlock);
    dom.remove(marker);

    if (parentBlock && dom.isEmpty(parentBlock)) {
      editor.$(parentBlock).empty();

      rng.setStart(parentBlock, 0);
      rng.setEnd(parentBlock, 0);

      if (!isTableCell(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {
        rng = nextRng;
        dom.remove(parentBlock);
      } else {
        dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));
      }
    }

    selection.setRng(rng);
  };
开发者ID:nyroDev,项目名称:tinymce,代码行数:81,代码来源:InsertContent.ts

示例3: removeUnderlineAndFontInAnchor

function removeUnderlineAndFontInAnchor(editor: Editor, root: Element) {
  editor.$('a', root).find('font,u').each(function (i, node) {
    editor.dom.remove(node, true);
  });
}
开发者ID:abstask,项目名称:tinymce,代码行数:5,代码来源:Quirks.ts


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