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


TypeScript Editor.on方法代码示例

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


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

示例1: Plugin

function Plugin(editor: Editor) {
  const resizeHandler = ResizeHandler(editor);
  const cellSelection = CellSelection(editor, resizeHandler.lazyResize);
  const actions = TableActions(editor, resizeHandler.lazyWire);
  const selections = Selections(editor);
  const clipboardRows = Cell(Option.none());

  Commands.registerCommands(editor, actions, cellSelection, selections, clipboardRows);
  Clipboard.registerEvents(editor, selections, actions, cellSelection);

  MenuItems.addMenuItems(editor, selections);
  Buttons.addButtons(editor);
  Buttons.addToolbars(editor);

  editor.on('PreInit', function () {
    editor.serializer.addTempAttr(Ephemera.firstSelected());
    editor.serializer.addTempAttr(Ephemera.lastSelected());
  });

  if (hasTabNavigation(editor)) {
    editor.on('keydown', function (e: KeyboardEvent) {
      TabContext.handle(e, editor, actions, resizeHandler.lazyWire);
    });
  }

  editor.on('remove', function () {
    resizeHandler.destroy();
    cellSelection.destroy();
  });

  return getApi(editor, clipboardRows);
}
开发者ID:danielpunkass,项目名称:tinymce,代码行数:32,代码来源:Plugin.ts

示例2: function

const setup = function (editor: Editor, headState, footState) {
  editor.on('BeforeSetContent', function (evt) {
    handleSetContent(editor, headState, footState, evt);
  });
  editor.on('GetContent', function (evt) {
    handleGetContent(editor, headState.get(), footState.get(), evt);
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:FilterContent.ts

示例3: function

const setup = function (editor: Editor, caret: Cell<Text>) {
  editor.on('keydown', function (evt: EditorEvent<KeyboardEvent>) {
    if (evt.isDefaultPrevented() === false) {
      executeKeydownOverride(editor, caret, evt);
    }
  });

  editor.on('keyup', function (evt: EditorEvent<KeyboardEvent>) {
    if (evt.isDefaultPrevented() === false) {
      executeKeyupOverride(editor, evt);
    }
  });
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:13,代码来源:DeleteBackspaceKeys.ts

示例4: function

const setup = function (editor: Editor) {
  editor.on('keydown', function (event: EditorEvent<KeyboardEvent>) {
    if (event.keyCode === VK.ENTER) {
      handleEnterKeyEvent(editor, event);
    }
  });
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:7,代码来源:EnterKey.ts

示例5:

const preventSummaryToggle = (editor: Editor) => {
  editor.on('click', (e) => {
    if (editor.dom.getParent(e.target, 'details')) {
      e.preventDefault();
    }
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:DetailsElement.ts

示例6: normalizeSelection

const setup = (editor: Editor) => {
  editor.on('click', (e) => {
    if (e.detail >= 3) {
      normalizeSelection(editor);
    }
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:MultiClickSelection.ts

示例7:

    setup: (ed: Editor) => {
      ed.on('init', () => {
        ed.annotator.register('alpha', {
          decorate: (uid, data) => {
            return {
              attributes: {
                'data-test-anything': data.anything
              },
              classes: [ ]
            };
          }
        });

        ed.annotator.register('beta', {
          decorate: (uid, data) => {
            return {
              attributes: {
                'data-test-something': data.something
              },
              classes: [ ]
            };
          }
        });
      });
    }
开发者ID:danielpunkass,项目名称:tinymce,代码行数:25,代码来源:AnnotationRemovedTest.ts

示例8:

const setup = (editor: Editor, toggleState) => {
  editor.on('init', () => {
    // should be false when enabled, so toggling will change it to true
    const valueForToggling = !Settings.isEnabledByDefault(editor);
    toggleState.set(valueForToggling);
    Actions.toggleVisualChars(editor, toggleState);
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:Bindings.ts

示例9: function

const setup = function (editor: Editor) {
  editor.on('keydown', function (event: EditorEvent<KeyboardEvent>) {
  // Don't allow enter key with command key modifier to be interpreted as a newline.
  if ((event.keyCode === VK.ENTER) && (event.metaKey !== true)) {
      handleEnterKeyEvent(editor, event);
    }
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:EnterKey.ts

示例10: function

const setup = function (editor: Editor) {
  const plugin = editor.plugins.paste;

  const preProcess = Settings.getPreProcess(editor);
  if (preProcess) {
    editor.on('PastePreProcess', function (e) {
      preProcess.call(plugin, plugin, e);
    });
  }

  const postProcess = Settings.getPostProcess(editor);
  if (postProcess) {
    editor.on('PastePostProcess', function (e) {
      postProcess.call(plugin, plugin, e);
    });
  }
};
开发者ID:abstask,项目名称:tinymce,代码行数:17,代码来源:PrePostProcess.ts

示例11: function

const register = function (editor: Editor, pluginUrl: string, startedState: Cell<boolean>, textMatcherState: Cell<DomTextMatcher>, currentLanguageState: Cell<string>, lastSuggestionsState: Cell<LastSuggestion>) {
  const languageMenuItems = buildMenuItems('Language', getItems(editor));
  const startSpellchecking = function () {
    Actions.spellcheck(editor, pluginUrl, startedState, textMatcherState, lastSuggestionsState, currentLanguageState);
  };

  const buttonArgs: any = {
    tooltip: 'Spellcheck',
    onclick: startSpellchecking,
    onPostRender (e) {
      const ctrl = e.control;

      editor.on('SpellcheckStart SpellcheckEnd', function () {
        ctrl.active(startedState.get());
      });
    }
  };

  if (languageMenuItems.length > 1) {
    buttonArgs.type = 'splitbutton';
    buttonArgs.menu = languageMenuItems;
    buttonArgs.onshow = updateSelection(editor, currentLanguageState);
    buttonArgs.onselect = function (e) {
      currentLanguageState.set(e.control.settings.data);
    };
  }

  editor.addButton('spellchecker', buttonArgs);

  editor.addMenuItem('spellchecker', {
    text: 'Spellcheck',
    context: 'tools',
    onclick: startSpellchecking,
    selectable: true,
    onPostRender () {
      const self = this;

      self.active(startedState.get());

      editor.on('SpellcheckStart SpellcheckEnd', function () {
        self.active(startedState.get());
      });
    }
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:45,代码来源:Buttons.ts

示例12: function

const stateChange = function (editor: Editor, clipboard: Clipboard, e) {
  const ctrl = e.control;

  ctrl.active(clipboard.pasteFormat.get() === 'text');

  editor.on('PastePlainTextToggle', function (e) {
    ctrl.active(e.state);
  });
};
开发者ID:abstask,项目名称:tinymce,代码行数:9,代码来源:Buttons.ts

示例13: function

const registerEvents = function (editor: Editor, selections: Selections, actions: TableActions, cellSelection) {
  editor.on('BeforeGetContent', function (e) {
    const multiCellContext = function (cells) {
      e.preventDefault();
      extractSelected(cells).each(function (elements) {
        e.content = e.format === 'text' ? getTextContent(elements) : serializeElements(editor, elements);
      });
    };

    if (e.selection === true) {
      SelectionTypes.cata(selections.get(), Fun.noop, multiCellContext, Fun.noop);
    }
  });

  editor.on('BeforeSetContent', function (e) {
    if (e.selection === true && e.paste === true) {
      const cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
      cellOpt.each(function (domCell) {
        const cell = Element.fromDom(domCell);
        const table = TableLookup.table(cell);
        table.bind(function (table) {

          const elements = Arr.filter(Elements.fromHtml(e.content), function (content) {
            return Node.name(content) !== 'meta';
          });

          if (elements.length === 1 && Node.name(elements[0]) === 'table') {
            e.preventDefault();

            const doc = Element.fromDom(editor.getDoc());
            const generators = TableFill.paste(doc);
            const targets = TableTargets.paste(cell, elements[0], generators);
            actions.pasteCells(table, targets).each(function (rng) {
              editor.selection.setRng(rng);
              editor.focus();
              cellSelection.clear(table);
            });
          }
        });
      });
    }
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:43,代码来源:Clipboard.ts

示例14:

 onpostrender: (ctrl) => {
   const button = ctrl.control;
   ed.on('init', () => {
     ed.annotator.annotationChanged('alpha', (state, name, obj) => {
       if (! state) {
         button.active(false);
       } else {
         button.active(true);
       }
     });
   });
 }
开发者ID:danielpunkass,项目名称:tinymce,代码行数:12,代码来源:AnnotationsDemo.ts

示例15: function

const fireSkinLoaded = function (editor: Editor, callback: Function) {
  const done = function () {
    editor._skinLoaded = true;
    Events.fireSkinLoaded(editor);
    callback();
  };

  if (editor.initialized) {
    done();
  } else {
    editor.on('init', done);
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:SkinLoader.ts


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