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


TypeScript Editor.focus方法代码示例

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


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

示例1: prompt

 onclick: () => {
   const comment = prompt('Comment with?');
   ed.annotator.annotate('alpha', {
     comment
   });
   ed.focus();
 },
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:AnnotationsDemo.ts

示例2: function

  const create = function (editor: Editor, toolbars: ContextToolbar[]) {
    const items = createToolbars(editor, toolbars).concat([
      Toolbar.create(editor, 'text', Settings.getTextSelectionToolbarItems(editor)),
      Toolbar.create(editor, 'insert', Settings.getInsertToolbarItems(editor)),
      Forms.createQuickLinkForm(editor, hide)
    ]);

    return Factory.create({
      type: 'floatpanel',
      role: 'dialog',
      classes: 'tinymce tinymce-inline arrow',
      ariaLabel: 'Inline toolbar',
      layout: 'flex',
      direction: 'column',
      align: 'stretch',
      autohide: false,
      autofix: true,
      fixed: true,
      border: 1,
      items: Tools.grep(items, hasToolbarItems),
      oncancel () {
        editor.focus();
      }
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:25,代码来源:Panel.ts

示例3: execute

 execute(table, targets).each(function (rng) {
   resizeChange(editor, beforeSize, table);
   editor.selection.setRng(rng);
   editor.focus();
   cellSelection.clear(table);
   Util.removeDataStyle(table);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:Commands.ts

示例4: restoreDraft

const restoreLastDraft = (editor: Editor) => {
  editor.undoManager.transact(() => {
    restoreDraft(editor);
    removeDraft(editor);
  });

  editor.focus();
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:Storage.ts

示例5: function

  const execCommand = function (command, ui, value, args) {
    let func, customCommand, state = false;

    if (editor.removed) {
      return;
    }

    if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {
      editor.focus();
    } else {
      SelectionBookmark.restore(editor);
    }

    args = editor.fire('BeforeExecCommand', { command, ui, value });
    if (args.isDefaultPrevented()) {
      return false;
    }

    customCommand = command.toLowerCase();
    if ((func = commands.exec[customCommand])) {
      func(customCommand, ui, value);
      editor.fire('ExecCommand', { command, ui, value });
      return true;
    }

    // Plugin commands
    each(editor.plugins, function (p) {
      if (p.execCommand && p.execCommand(command, ui, value)) {
        editor.fire('ExecCommand', { command, ui, value });
        state = true;
        return false;
      }
    });

    if (state) {
      return state;
    }

    // Theme commands
    if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {
      editor.fire('ExecCommand', { command, ui, value });
      return true;
    }

    // Browser commands
    try {
      state = editor.getDoc().execCommand(command, ui, value);
    } catch (ex) {
      // Ignore old IE errors
    }

    if (state) {
      editor.fire('ExecCommand', { command, ui, value });
      return true;
    }

    return false;
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:58,代码来源:EditorCommands.ts

示例6: function

const initEditor = function (editor: Editor) {
  editor.bindPendingEventDelegates();
  editor.initialized = true;
  editor.fire('init');
  editor.focus(true);
  editor.nodeChanged({ initial: true });
  editor.execCallback('init_instance_callback', editor);
  autoFocus(editor);
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:InitContentBody.ts

示例7:

const deleteImage = (editor: Editor, image: HTMLElement) => {
  if (image) {
    const elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;

    editor.dom.remove(elm);
    editor.focus();
    editor.nodeChanged();

    if (editor.dom.isEmpty(editor.getBody())) {
      editor.setContent('');
      editor.selection.setCursorLocation();
    }
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:14,代码来源:ImageSelection.ts

示例8: function

const togglePlainTextPaste = function (editor: Editor, clipboard: Clipboard, userIsInformedState) {
  if (clipboard.pasteFormat.get() === 'text') {
    clipboard.pasteFormat.set('html');
    Events.firePastePlainTextToggle(editor, false);
  } else {
    clipboard.pasteFormat.set('text');
    Events.firePastePlainTextToggle(editor, true);

    if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
      displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
      userIsInformedState.set(true);
    }
  }

  editor.focus();
};
开发者ID:abstask,项目名称:tinymce,代码行数:16,代码来源:Actions.ts

示例9: create

const insertImageAtCaret = (editor: Editor, data: ImageData) => {
  const elm = create((css) => normalizeCss(editor, css), data);

  editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
  editor.focus();
  editor.selection.setContent(elm.outerHTML);

  const insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
  editor.dom.setAttrib(insertedElm, 'data-mce-id', null);

  if (isFigure(insertedElm)) {
    const figure = splitTextBlock(editor, insertedElm);
    editor.selection.select(figure);
  } else {
    editor.selection.select(insertedElm);
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:17,代码来源:ImageSelection.ts

示例10: toggleClass

const toggleReadOnly = (editor: Editor, state: boolean) => {
  toggleClass(Element.fromDom(editor.getBody()), 'mce-content-readonly', state);

  if (state) {
    editor.selection.controlSelection.hideResizeRect();
    editor.readonly = true;
    editor.getBody().contentEditable = 'false';
  } else {
    editor.readonly = false;
    editor.getBody().contentEditable = 'true';
    setEditorCommandState(editor, 'StyleWithCSS', false);
    setEditorCommandState(editor, 'enableInlineTableEditing', false);
    setEditorCommandState(editor, 'enableObjectResizing', false);
    editor.focus();
    editor.nodeChanged();
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:17,代码来源:Mode.ts


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