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


TypeScript Remove.remove方法代碼示例

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


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

示例1:

const removeEmpty = (text: Element): Option<Element> => {
  if (text.dom().length === 0) {
    Remove.remove(text);
    return Option.none();
  }
  return Option.some(text);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:SetSelectionContent.ts

示例2: 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

示例3:

 table.filter(Fun.not(isRoot)).each(function (table) {
   const cursor = Element.fromText('');
   Insert.after(table, cursor);
   Remove.remove(table);
   const rng = editor.dom.createRng();
   rng.setStart(cursor.dom(), 0);
   rng.setEnd(cursor.dom(), 0);
   editor.selection.setRng(rng);
 });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:9,代碼來源:TableCommands.ts

示例4: indentSelectedEntries

 Arr.each(entrySets, (entrySet) => {
   indentSelectedEntries(entrySet.entries, indentation);
   const composedLists = composeEntries(editor, entrySet.entries);
   Arr.each(composedLists, (composedList) => {
     fireListEvent(editor, indentation === Indentation.Indent ? ListAction.IndentList : ListAction.OutdentList, composedList.dom());
   });
   InsertAll.before(entrySet.sourceList, composedLists);
   Remove.remove(entrySet.sourceList);
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:ListsIndendation.ts

示例5: function

  return Options.liftN([Traverse.prevSibling(elm), Traverse.nextSibling(elm), afterDeletePosOpt], function (prev, next, afterDeletePos) {
    let offset;
    const prevNode = prev.dom();
    const nextNode = next.dom();

    if (NodeType.isText(prevNode) && NodeType.isText(nextNode)) {
      offset = prevNode.data.length;
      prevNode.appendData(nextNode.data);
      Remove.remove(next);
      Remove.remove(elm);
      if (afterDeletePos.container() === nextNode) {
        return new CaretPosition(prevNode, offset);
      } else {
        return afterDeletePos;
      }
    } else {
      Remove.remove(elm);
      return afterDeletePos;
    }
  }).orThunk(function () {
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:20,代碼來源:DeleteElement.ts

示例6: normalizeWhitespaceAfter

const mergeTextNodes = (prevNode: Text, nextNode: Text, normalizeWhitespace?: boolean): Text => {
  const whitespaceOffset = Strings.rTrim(prevNode.data).length;
  // Merge the elements
  prevNode.appendData(nextNode.data);
  Remove.remove(Element.fromDom(nextNode));

  // Normalize the whitespace around the merged elements, to ensure it doesn't get lost
  if (normalizeWhitespace) {
    normalizeWhitespaceAfter(prevNode, whitespaceOffset);
  }

  return prevNode;
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:13,代碼來源:MergeText.ts

示例7: function

const input = function (parent, operation) {
  // to capture focus allowing the keyboard to remain open with no 'real' selection
  const input = Element.fromTag('input');
  Css.setAll(input, {
    opacity: '0',
    position: 'absolute',
    top: '-1000px',
    left: '-1000px'
  });
  Insert.append(parent, input);

  Focus.focus(input);
  operation(input);
  Remove.remove(input);
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:15,代碼來源:CaptureBin.ts

示例8: removeEmptyRoot

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

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

示例9:

        tableOpt.filter(Fun.not(isRoot)).each((table) => {
          const cursor = Element.fromText('');
          Insert.after(table, cursor);
          Remove.remove(table);

          if (editor.dom.isEmpty(editor.getBody())) {
            editor.setContent('');
            editor.selection.setCursorLocation();
          } else {
            const rng = editor.dom.createRng();
            rng.setStart(cursor.dom(), 0);
            rng.setEnd(cursor.dom(), 0);
            editor.selection.setRng(rng);
            editor.nodeChanged();
          }
        });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:16,代碼來源:Commands.ts

示例10: function

const mergeBlockInto = function (rootNode, fromBlock, toBlock) {
  if (Empty.isEmpty(toBlock)) {
    Remove.remove(toBlock);

    if (Empty.isEmpty(fromBlock)) {
      PaddingBr.fillWithPaddingBr(fromBlock);
    }

    return CaretFinder.firstPositionIn(fromBlock.dom());
  } else {
    trimBr(true, fromBlock);
    trimBr(false, toBlock);

    const children = extractChildren(fromBlock);

    return getInsertionPoint(fromBlock, toBlock).fold(
      function () {
        removeEmptyRoot(rootNode, fromBlock);

        const position = CaretFinder.lastPositionIn(toBlock.dom());

        Arr.each(children, function (node) {
          Insert.append(toBlock, node);
        });

        return position;
      },
      function (target) {
        const position = CaretFinder.prevPosition(toBlock.dom(), CaretPosition.before(target.dom()));

        Arr.each(children, function (node) {
          Insert.before(target, node);
        });

        removeEmptyRoot(rootNode, fromBlock);

        return position;
      }
    );
  }
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:41,代碼來源:MergeBlocks.ts


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