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


TypeScript Insert.after方法代码示例

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


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

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

示例2:

 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

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

        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

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

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

示例7: function

  function () {
    const success = arguments[arguments.length - 2];
    const failure = arguments[arguments.length - 1];

    TinyLoader.setup(function (editor, onSuccess, onFailure) {
      const tinyApis = TinyApis(editor);

      Pipeline.async({}, [
        Logger.t('Tests if the editor is responsive after setting theme to a function', GeneralSteps.sequence([
          tinyApis.sSetContent('<p>a</p>'),
          tinyApis.sAssertContent('<p>a</p>')
        ])),
        Logger.t('Editor element properties', Step.sync(function () {
          const body = Element.fromDom(document.body);
          const targetElement = SelectorFind.descendant(body, '#' + editor.id).getOrDie('No elm');
          const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');

          Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
          Assertions.assertDomEq('Should be expected editor body element', targetElement, Element.fromDom(editor.getBody()));
          Assertions.assertDomEq('Should be expected editor target element', targetElement, Element.fromDom(editor.getElement()));
          Assertions.assertEq('Should be undefined for inline mode', undefined, editor.contentAreaContainer);
        }))
      ], onSuccess, onFailure);
    }, {
      theme (editor, target) {
        const elm = Element.fromHtml('<div><button>B</button><div></div></div>');

        Insert.after(Element.fromDom(target), elm);

        return {
          editorContainer: elm.dom()
        };
      },
      skin_url: '/project/js/tinymce/skins/lightgray',
      inline: true,
      init_instance_callback (editor) {
        editor.fire('SkinLoaded');
      }
    }, success, failure);
  }
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:40,代码来源:InitEditorThemeFunctionInlineTest.ts

示例8: function

  const renderUI = function (args) {
    const cssUrls = CssUrls.derive(editor);

    if (Settings.isSkinDisabled(editor) === false) {
      editor.contentCSS.push(cssUrls.content);
      DOMUtils.DOM.styleSheetLoader.load(cssUrls.ui, SkinLoaded.fireSkinLoaded(editor));
    } else {
      SkinLoaded.fireSkinLoaded(editor)();
    }

    const doScrollIntoView = function () {
      editor.fire('scrollIntoView');
    };

    const wrapper = Element.fromTag('div');
    const realm = PlatformDetection.detect().os.isAndroid() ? AndroidRealm(doScrollIntoView) : IosRealm(doScrollIntoView);
    const original = Element.fromDom(args.targetNode);
    Insert.after(original, wrapper);
    Attachment.attachSystem(wrapper, realm.system());

    const findFocusIn = function (elem) {
      return Focus.search(elem).bind(function (focused) {
        return realm.system().getByDom(focused).toOption();
      });
    };
    const outerWindow = args.targetNode.ownerDocument.defaultView;
    const orientation = Orientation.onChange(outerWindow, {
      onChange () {
        const alloy = realm.system();
        alloy.broadcastOn([ TinyChannels.orientationChanged() ], { width: Orientation.getActualWidth(outerWindow) });
      },
      onReady: Fun.noop
    });

    const setReadOnly = function (readOnlyGroups, mainGroups, ro) {
      if (ro === false) {
        editor.selection.collapse();
      }
      realm.setToolbarGroups(ro ? readOnlyGroups.get() : mainGroups.get());
      editor.setMode(ro === true ? 'readonly' : 'design');
      editor.fire(ro === true ? READING() : EDITING());
      realm.updateMode(ro);
    };

    const bindHandler = function (label, handler) {
      editor.on(label, handler);
      return {
        unbind () {
          editor.off(label);
        }
      };
    };

    editor.on('init', function () {
      realm.init({
        editor: {
          getFrame () {
            return Element.fromDom(editor.contentAreaContainer.querySelector('iframe'));
          },

          onDomChanged () {
            return {
              unbind: Fun.noop
            };
          },

          onToReading (handler) {
            return bindHandler(READING(), handler);
          },

          onToEditing (handler) {
            return bindHandler(EDITING(), handler);
          },

          onScrollToCursor (handler) {
            editor.on('scrollIntoView', function (tinyEvent) {
              handler(tinyEvent);
            });

            const unbind = function () {
              editor.off('scrollIntoView');
              orientation.destroy();
            };

            return {
              unbind
            };
          },

          onTouchToolstrip () {
            hideDropup();
          },

          onTouchContent () {
            const toolbar = Element.fromDom(editor.editorContainer.querySelector('.' + Styles.resolve('toolbar')));
            // If something in the toolbar had focus, fire an execute on it (execute on tap away)
            // Perhaps it will be clearer later what is a better way of doing this.
            findFocusIn(toolbar).each(AlloyTriggers.emitExecute);
            realm.restoreToolbar();
            hideDropup();
//.........这里部分代码省略.........
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:101,代码来源:Theme.ts


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