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


TypeScript EditorManager.get函数代码示例

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


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

示例1:

      Step.sync(function () {
        const caretElm0 = EditorManager.get(0).getBody().querySelector('[data-mce-caret]');
        const caretElm1 = EditorManager.get(1).getBody().querySelector('[data-mce-caret]');

        Assertions.assertEq('Should not be a caret element present editor 0', false, !!caretElm0);
        Assertions.assertEq('Should be a caret element present editor 1', true, !!caretElm1);
      }),
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:CefFocusTest.ts

示例2: function

    Tools.each(invalidNames.split(' '), function (invalidName) {
      const elm = DOMUtils.DOM.add(document.body, invalidName, { class: 'targetEditor' }, null);

      EditorManager.init({
        selector: invalidName + '.targetEditor',
        skin_url: '/project/js/tinymce/skins/lightgray',
        inline: true
      });

      LegacyUnit.strictEqual(EditorManager.get().length, 0, 'Should not have created an editor');
      DOMUtils.DOM.remove(elm);
    });
开发者ID:abstask,项目名称:tinymce,代码行数:12,代码来源:EditorManagerTest.ts

示例3: function

  suite.asyncTest('get', function (_, done) {
    viewBlock.update('<textarea class="tinymce"></textarea>');
    EditorManager.init({
      selector: 'textarea.tinymce',
      skin_url: '/project/tinymce/js/tinymce/skins/ui/oxide',
      content_css: '/project/tinymce/js/tinymce/skins/content/default',
      init_instance_callback (editor1) {
        LegacyUnit.equal(EditorManager.get().length, 1);
        LegacyUnit.equal(EditorManager.get(0) === EditorManager.activeEditor, true);
        LegacyUnit.equal(EditorManager.get(1), null);
        LegacyUnit.equal(EditorManager.get('noid'), null);
        LegacyUnit.equal(EditorManager.get(undefined), null);
        LegacyUnit.equal(EditorManager.get()[0] === EditorManager.activeEditor, true);
        LegacyUnit.equal(EditorManager.get(EditorManager.activeEditor.id) === EditorManager.activeEditor, true);
        LegacyUnit.equal(EditorManager.get() !== EditorManager.get(), true);

        // Trigger save
        let saveCount = 0;

        editor1.on('SaveContent', function () {
          saveCount++;
        });

        EditorManager.triggerSave();
        LegacyUnit.equal(saveCount, 1);

        // Re-init on same id
        EditorManager.init({
          selector: '#' + EditorManager.activeEditor.id,
          skin_url: '/project/tinymce/js/tinymce/skins/ui/oxide',
          content_css: '/project/tinymce/js/tinymce/skins/content/default',
        });

        LegacyUnit.equal(EditorManager.get().length, 1);

        teardown(done);
      }
    });
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:39,代码来源:EditorManagerTest.ts

示例4: function

EditorManager._beforeUnloadHandler = function () {
  let msg;

  Tools.each(EditorManager.get(), function (editor) {
    // Store a draft for each editor instance
    if (editor.plugins.autosave) {
      editor.plugins.autosave.storeDraft();
    }

    // Setup a return message if the editor is dirty
    if (!msg && editor.isDirty() && Settings.shouldAskBeforeUnload(editor)) {
      msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
    }
  });

  return msg;
};
开发者ID:abstask,项目名称:tinymce,代码行数:17,代码来源:BeforeUnload.ts

示例5: init_instance_callback

        Delay.setTimeout(function () {
          // Destroy the editor by setting innerHTML common ajax pattern
          viewBlock.update('<textarea id="' + editor1.id + '"></textarea>');

          // Re-init the editor will have the same id
          EditorManager.init({
            selector: 'textarea',
            skin_url: '/project/js/tinymce/skins/lightgray',
            init_instance_callback (editor2) {
              LegacyUnit.equal(EditorManager.get().length, 1);
              LegacyUnit.equal(editor1.id, editor2.id);
              LegacyUnit.equal(editor1.destroyed, 1, 'First editor instance should be destroyed');

              teardown(done);
            }
          });
        }, 0);
开发者ID:abstask,项目名称:tinymce,代码行数:17,代码来源:EditorManagerTest.ts

示例6: canSelect

 function canSelect(el) {
   return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && EditorManager.get(e.id) && el.tabIndex !== -1 && canSelectRecursive(el);
 }
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:Keyboard.ts

示例7: tabHandler

  function tabHandler(e) {
    let x, el, v, i;

    if (e.keyCode !== VK.TAB || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
      return;
    }

    function find(direction) {
      el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');

      function canSelectRecursive(e) {
        return e.nodeName === 'BODY' || (e.type !== 'hidden' &&
          e.style.display !== 'none' &&
          e.style.visibility !== 'hidden' && canSelectRecursive(e.parentNode));
      }

      function canSelect(el) {
        return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && EditorManager.get(e.id) && el.tabIndex !== -1 && canSelectRecursive(el);
      }

      Tools.each(el, function (e, i) {
        if (e.id === editor.id) {
          x = i;
          return false;
        }
      });
      if (direction > 0) {
        for (i = x + 1; i < el.length; i++) {
          if (canSelect(el[i])) {
            return el[i];
          }
        }
      } else {
        for (i = x - 1; i >= 0; i--) {
          if (canSelect(el[i])) {
            return el[i];
          }
        }
      }

      return null;
    }

    v = Tools.explode(Settings.getTabFocus(editor));

    if (v.length === 1) {
      v[1] = v[0];
      v[0] = ':prev';
    }

    // Find element to focus
    if (e.shiftKey) {
      if (v[0] === ':prev') {
        el = find(-1);
      } else {
        el = DOM.get(v[0]);
      }
    } else {
      if (v[1] === ':next') {
        el = find(1);
      } else {
        el = DOM.get(v[1]);
      }
    }

    if (el) {
      const focusEditor = EditorManager.get(el.id || el.name);

      if (el.id && focusEditor) {
        focusEditor.focus();
      } else {
        Delay.setTimeout(function () {
          if (!Env.webkit) {
            window.focus();
          }

          el.focus();
        }, 10);
      }

      e.preventDefault();
    }
  }
开发者ID:danielpunkass,项目名称:tinymce,代码行数:83,代码来源:Keyboard.ts


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