當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Insert.before方法代碼示例

本文整理匯總了TypeScript中@ephox/sugar.Insert.before方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Insert.before方法的具體用法?TypeScript Insert.before怎麽用?TypeScript Insert.before使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/sugar.Insert的用法示例。


在下文中一共展示了Insert.before方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

const replaceWithCaretFormat = function (targetNode, formatNodes) {
  const caretContainer = createCaretContainer(false);
  const innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom());
  Insert.before(Element.fromDom(targetNode), caretContainer);
  Remove.remove(Element.fromDom(targetNode));

  return CaretPosition(innerMost, 0);
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:8,代碼來源:CaretFormat.ts

示例2: getElementFromPosition

    return getElementFromPosition(pos).map((elm) => {
      const textNode = Element.fromText(text);

      if (pos.isAtEnd()) {
        Insert.after(elm, textNode);
      } else {
        Insert.before(elm, textNode);
      }

      return CaretPosition(textNode.dom(), text.length);
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:11,代碼來源:InsertText.ts

示例3: moveToRange

    editor.undoManager.transact(() => {
      const element = SugarElement.fromTag(forcedRootBlock);
      Attr.setAll(element, Settings.getForcedRootBlockAttrs(editor));
      Insert.append(element, SugarElement.fromTag('br'));

      if (down) {
        Insert.after(SugarElement.fromDom(table), element);
      } else {
        Insert.before(SugarElement.fromDom(table), element);
      }

      const rng = editor.dom.createRng();
      rng.setStart(element.dom(), 0);
      rng.setEnd(element.dom(), 0);
      moveToRange(editor, rng);
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:16,代碼來源:TableNavigation.ts

示例4:

const wrapWithSiblings = (dom: DOMUtils, node: Node, next: boolean, name: string, attrs?): Node => {
  const start = Element.fromDom(node);
  const wrapper = Element.fromDom(dom.create(name, attrs));
  const siblings = next ? Traverse.nextSiblings(start) : Traverse.prevSiblings(start);

  InsertAll.append(wrapper, siblings);
  if (next) {
    Insert.before(start, wrapper);
    Insert.prepend(wrapper, start);
  } else {
    Insert.after(start, wrapper);
    Insert.append(wrapper, start);
  }

  return wrapper.dom();
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:16,代碼來源:RemoveFormat.ts

示例5: removeEmptyRoot

const nestedBlockMerge = (rootNode: Element, fromBlock: Element, toBlock: Element, insertionPoint: Element): Option<CaretPosition> => {
  if (Empty.isEmpty(toBlock)) {
    PaddingBr.fillWithPaddingBr(toBlock);
    return CaretFinder.firstPositionIn(toBlock.dom());
  }

  if (isEmptyBefore(insertionPoint) && Empty.isEmpty(fromBlock)) {
    Insert.before(insertionPoint, Element.fromTag('br'));
  }

  const position = CaretFinder.prevPosition(toBlock.dom(), CaretPosition.before(insertionPoint.dom()));
  Arr.each(extractChildren(fromBlock), (child) => {
    Insert.before(insertionPoint, child);
  });
  removeEmptyRoot(rootNode, fromBlock);
  return position;
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:17,代碼來源:MergeBlocks.ts

示例6: function

const insertBrBefore = function (editor, inline) {
  const br = Element.fromTag('br');
  Insert.before(Element.fromDom(inline), br);
  editor.undoManager.add();
};
開發者ID:howardjing,項目名稱:tinymce,代碼行數:5,代碼來源:InsertBr.ts

示例7: function

 Arr.each(children, function (node) {
   Insert.before(target, node);
 });
開發者ID:abstask,項目名稱:tinymce,代碼行數:3,代碼來源:MergeBlocks.ts

示例8:

 Arr.each(extractChildren(fromBlock), (child) => {
   Insert.before(insertionPoint, child);
 });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:3,代碼來源:MergeBlocks.ts


注:本文中的@ephox/sugar.Insert.before方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。