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


TypeScript sugar.Remove类代码示例

本文整理汇总了TypeScript中@ephox/sugar.Remove的典型用法代码示例。如果您正苦于以下问题:TypeScript Remove类的具体用法?TypeScript Remove怎么用?TypeScript 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: 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

示例4:

 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

示例5: function

const paddEmptyBlock = function (elm) {
  if (Empty.isEmpty(elm)) {
    const br = Element.fromHtml('<br data-mce-bogus="1">');
    Remove.empty(elm);
    Insert.append(elm, br);
    return Option.some(CaretPosition.before(br.dom()));
  } else {
    return Option.none();
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:DeleteElement.ts

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

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

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

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

示例10:

        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


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