當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript EditorManager.init函數代碼示例

本文整理匯總了TypeScript中tinymce/core/api/EditorManager.init函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript init函數的具體用法?TypeScript init怎麽用?TypeScript init使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了init函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

  suite.asyncTest('Do not reload language pack if it was already loaded or registered manually.', function (_, done) {
    const langCode = 'mce_lang';
    const langUrl = 'http://example.com/language/' + langCode + '.js';

    EditorManager.addI18n(langCode, {
      from: 'to'
    });

    viewBlock.update('<textarea></textarea>');

    EditorManager.init({
      selector: 'textarea',
      skin_url: '/project/js/tinymce/skins/lightgray',
      language: langCode,
      language_url: langUrl,
      init_instance_callback (ed) {
        const scripts = Tools.grep(document.getElementsByTagName('script'), function (script) {
          return script.src === langUrl;
        });

        LegacyUnit.equal(scripts.length, 0);

        teardown(done);
      }
    });
  });
開發者ID:abstask,項目名稱:tinymce,代碼行數:26,代碼來源:EditorManagerTest.ts

示例2: function

  const setup = function (success, failure) {
    const div = document.createElement('div');

    div.innerHTML = (
      '<div id="lists">' +
      '<ul><li>before</li></ul>' +
      '<ul id="inline"><li>x</li></ul>' +
      '<ul><li>after</li></ul>' +
      '</div>'
    );

    document.body.appendChild(div);

    EditorManager.init({
      selector: '#inline',
      inline: true,
      add_unload_trigger: false,
      skin: false,
      plugins: 'lists',
      disable_nodechange: true,
      init_instance_callback (editor) {
        Pipeline.async({}, suite.toSteps(editor), function () {
          teardown(editor, div);
          success();
        }, failure);
      },
      valid_styles: {
        '*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,' +
        'margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left,list-style-type'
      }
    });
  };
開發者ID:abstask,項目名稱:tinymce,代碼行數:32,代碼來源:BackspaceDeleteInlineTest.ts

示例3: function

 suite.asyncTest('selector on non existing targets', function (_, done) {
   EditorManager.init({
     selector: '#non-existing-id',
     skin_url: '/project/js/tinymce/skins/lightgray'
   }).then(function (result) {
     Assertions.assertEq('Should be an result that is zero length', 0, result.length);
     teardown(done);
   });
 });
開發者ID:abstask,項目名稱:tinymce,代碼行數:9,代碼來源:EditorInitializationTest.ts

示例4:

  const mCreateInlineModeMultipleInstances = Step.stateful(function (value, next, die) {
    viewBlock.update('<div class="tinymce-editor"><p>a</p></div><div class="tinymce-editor"><p>b</p></div>');

    EditorManager.init({
      selector: '.tinymce-editor',
      inline: true,
      skin_url: '/project/js/tinymce/skins/lightgray'
    }).then(next, die);
  });
開發者ID:abstask,項目名稱:tinymce,代碼行數:9,代碼來源:EditorInitializationTest.ts

示例5:

  const mCreateInlineModeMultipleInstances = Step.label('mCreateInlineModeMultipleInstances', Step.stateful(function (value, next, die) {
    viewBlock.update('<div class="tinymce-editor"><p>a</p></div><div class="tinymce-editor"><p>b</p></div>');

    EditorManager.init({
      selector: '.tinymce-editor',
      inline: true,
      skin_url: '/project/tinymce/js/tinymce/skins/ui/oxide',
      content_css: '/project/tinymce/js/tinymce/skins/content/default',
    }).then(next, die);
  }));
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:EditorInitializationTest.ts

示例6: done

    return Step.async(function (done) {
      viewBlock.update(html);

      EditorManager.init({
        selector: '.tinymce',
        inline: true,
        skin_url: '/project/js/tinymce/skins/lightgray'
      }).then(function () {
        done();
      });
    });
開發者ID:abstask,項目名稱:tinymce,代碼行數:11,代碼來源:CefFocusTest.ts

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


注:本文中的tinymce/core/api/EditorManager.init函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。