• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript sugar.Insert类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

const insertElement = (root: Element, elm: Element, forward: boolean) => {
  if (forward) {
    Insert.append(root, elm);
  } else {
    Insert.prepend(root, elm);
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:ContentEndpointNavigation.ts


示例2: function

const appendStyle = function (editor: Editor, text: string) {
  const head = Element.fromDom(editor.getDoc().head);
  const tag = Element.fromTag('style');
  Attr.set(tag, 'type', 'text/css');
  Insert.append(tag, Element.fromText(text));
  Insert.append(head, tag);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:InitContentBody.ts


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


示例4: function

const insertBrAfter = function (editor, inline) {
  if (!hasBrAfter(editor.getBody(), inline)) {
    Insert.after(Element.fromDom(inline), Element.fromTag('br'));
  }

  const br = Element.fromTag('br');
  Insert.after(Element.fromDom(inline), br);
  scrollToBr(editor.dom, editor.selection, br.dom());
  moveSelectionToBr(editor.dom, editor.selection, br.dom(), false);
  editor.undoManager.add();
};
开发者ID:howardjing,项目名称:tinymce,代码行数:11,代码来源:InsertBr.ts


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


示例6: context

  const processElement = (elem) => {
    const ctx = context(editor, elem, 'span', Node.name(elem));

    switch (ctx) {
      case ChildContext.InvalidChild: {
        finishWrapper();
        const children = Traverse.children(elem);
        processElements(children);
        finishWrapper();
        break;
      }

      case ChildContext.Valid: {
        const w = getOrOpenWrapper();
        Insert.wrap(elem, w);
        break;
      }

      // INVESTIGATE: Are these sensible things to do?
      case ChildContext.Skipping:
      case ChildContext.Existing:
      case ChildContext.Caret: {
        // Do nothing.
      }
    }
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:26,代码来源:Wrapping.ts


示例7:

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


示例8: n

 NamedChain.write('container', Chain.async((input, n, die) => {
   const container = Element.fromTag('div');
   Attr.set(container, 'id', 'test-container-div');
   Html.set(container, containerHtml);
   Insert.append(Body.body(), container);
   n(container);
 })),
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:InlineEditorInsideTableTest.ts


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


示例10:

const createSegment = (scope: Document, listType: ListType): Segment => {
  const segment: Segment = {
    list: Element.fromTag(listType, scope),
    item: Element.fromTag('li', scope)
  };
  Insert.append(segment.list, segment.item);
  return segment;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:ComposeList.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript sugar.InsertAll类代码示例发布时间:2022-05-28
下一篇:
TypeScript sugar.Html类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap