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


TypeScript Plugin.default函数代码示例

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


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

示例1: function

export default function () {
  AdvListPlugin();
  AnchorPlugin();
  AutoLinkPlugin();
  AutoResizePlugin();
  AutoSavePlugin();
  BbCodePlugin();
  CharMapPlugin();
  CodePlugin();
  CodeSamplePlugin();
  ColorPickerPlugin();
  ContextMenuPlugin();
  DirectionalityPlugin();
  EmoticonsPlugin();
  FullPagePlugin();
  FullScreenPlugin();
  HrPlugin();
  ImagePlugin();
  ImageToolsPlugin();
  ImportCssPlugin();
  InsertDatetimePlugin();
  LegacyOutputPlugin();
  LinkPlugin();
  ListsPlugin();
  MediaPlugin();
  NonBreakingPlugin();
  NonEditablePlugin();
  PageBreakPlugin();
  PastePlugin();
  PreviewPlugin();
  PrintPlugin();
  SavePlugin();
  SearchReplacePlugin();
  SpellCheckerPlugin();
  TabFocusPlugin();
  TablePlugin();
  TemplatePlugin();
  TextColorPlugin();
  TextPatternPlugin();
  TocPlugin();
  VisualBlocksPlugin();
  VisualCharsPlugin();
  WordCountPlugin();
  ModernTheme();
  MobileTheme();
  HelpPlugin();

  PluginManager.urls.emoticons = '../../../../js/tinymce/plugins/emoticons';

  const settings = {
    skin_url: '../../../../js/tinymce/skins/lightgray',
    codesample_content_css: '../../../../js/tinymce/plugins/codesample/css/prism.css',
    visualblocks_content_css: '../../../../js/tinymce/plugins/visualblocks/css/visualblocks.css',
    images_upload_url: 'd',
    selector: 'textarea',
    // rtl_ui: true,
    link_list: [
      { title: 'My page 1', value: 'http://www.tinymce.com' },
      { title: 'My page 2', value: 'http://www.moxiecode.com' }
    ],
    image_list: [
      { title: 'My page 1', value: 'http://www.tinymce.com' },
      { title: 'My page 2', value: 'http://www.moxiecode.com' }
    ],
    image_class_list: [
      { title: 'None', value: '' },
      { title: 'Some class', value: 'class-name' }
    ],
    importcss_append: true,
    height: 400,
    file_picker_callback (callback, value, meta) {
      // Provide file and text for the link dialog
      if (meta.filetype === 'file') {
        callback('https://www.google.com/logos/google.jpg', { text: 'My text' });
      }

      // Provide image and alt text for the image dialog
      if (meta.filetype === 'image') {
        callback('https://www.google.com/logos/google.jpg', { alt: 'My alt text' });
      }

      // Provide alternative source and posted for the media dialog
      if (meta.filetype === 'media') {
        callback('movie.mp4', { source2: 'alt.ogg', poster: 'https://www.google.com/logos/google.jpg' });
      }
    },
    spellchecker_callback (method, text, success, failure) {
      const words = text.match(this.getWordCharPattern());

      if (method === 'spellcheck') {
        const suggestions = {};

        for (let i = 0; i < words.length; i++) {
          suggestions[words[i]] = ['First', 'Second'];
        }

        success(suggestions);
      }

      if (method === 'addToDictionary') {
//.........这里部分代码省略.........
开发者ID:howardjing,项目名称:tinymce,代码行数:101,代码来源:FullDemo.ts

示例2: function

export default function () {
  AdvListPlugin();
  AnchorPlugin();
  AutoLinkPlugin();
  AutoResizePlugin();
  AutoSavePlugin();
  BbCodePlugin();
  CharMapPlugin();
  CodePlugin();
  CodeSamplePlugin();
  ColorPickerPlugin();
  ContextMenuPlugin();
  DirectionalityPlugin();
  EmoticonsPlugin();
  FullPagePlugin();
  FullScreenPlugin();
  HrPlugin();
  ImagePlugin();
  ImageToolsPlugin();
  ImportCssPlugin();
  InsertDatetimePlugin();
  LegacyOutputPlugin();
  LinkPlugin();
  ListsPlugin();
  MediaPlugin();
  NonBreakingPlugin();
  NonEditablePlugin();
  PageBreakPlugin();
  PastePlugin();
  PreviewPlugin();
  PrintPlugin();
  SavePlugin();
  SearchReplacePlugin();
  SpellCheckerPlugin();
  TabFocusPlugin();
  TablePlugin();
  TemplatePlugin();
  TextColorPlugin();
  TextPatternPlugin();
  TocPlugin();
  VisualBlocksPlugin();
  VisualCharsPlugin();
  WordCountPlugin();
  ModernTheme();

  const cmd = function (command, value?) {
    return { command, value };
  };

  const commands = [
    cmd('Bold'),
    cmd('Italic'),
    cmd('Underline'),
    cmd('Strikethrough'),
    cmd('Superscript'),
    cmd('Subscript'),
    cmd('Cut'),
    cmd('Copy'),
    cmd('Paste'),
    cmd('Unlink'),
    cmd('JustifyLeft'),
    cmd('JustifyCenter'),
    cmd('JustifyRight'),
    cmd('JustifyFull'),
    cmd('JustifyNone'),
    cmd('InsertUnorderedList'),
    cmd('InsertOrderedList'),
    cmd('ForeColor', 'red'),
    cmd('HiliteColor', 'green'),
    cmd('FontName', 'Arial'),
    cmd('FontSize', 7),
    cmd('RemoveFormat'),
    cmd('mceBlockQuote'),
    cmd('FormatBlock', 'h1'),
    cmd('mceInsertContent', 'abc'),
    cmd('mceToggleFormat', 'bold'),
    cmd('mceSetContent', 'abc'),
    cmd('Indent'),
    cmd('Outdent'),
    cmd('InsertHorizontalRule'),
    cmd('mceToggleVisualAid'),
    cmd('mceInsertLink', 'url'),
    cmd('selectAll'),
    cmd('delete'),
    cmd('mceNewDocument'),
    cmd('Undo'),
    cmd('Redo'),
    cmd('mceAutoResize'),
    cmd('mceShowCharmap'),
    cmd('mceCodeEditor'),
    cmd('mceDirectionLTR'),
    cmd('mceDirectionRTL'),
    cmd('mceFullPageProperties'),
    cmd('mceFullscreen'),
    cmd('mceImage'),
    cmd('mceInsertDate'),
    cmd('mceInsertTime'),
    cmd('InsertDefinitionList'),
    cmd('mceNonBreaking'),
    cmd('mcePageBreak'),
//.........这里部分代码省略.........
开发者ID:howardjing,项目名称:tinymce,代码行数:101,代码来源:CommandsDemo.ts

示例3: function


//.........这里部分代码省略.........
                          title: str.is('Lower Alpha'),
                        },
                        children: [
                          s.element('div', {
                            classes: [ arr.has('tox-collection__item-icon') ]
                          })
                        ]
                      }),
                      s.element('div', {
                        classes: [
                          arr.has('tox-menu-nav__js'),
                          arr.has('tox-collection__item')
                        ],
                        attrs: {
                          title: str.is('Lower Greek'),
                        },
                        children: [
                          s.element('div', {
                            classes: [ arr.has('tox-collection__item-icon') ]
                          })
                        ]
                      })
                    ]
                  }),
                  // second row of icons
                  s.element('div', {
                    classes: [ arr.has('tox-collection__group') ],
                    children: [
                      s.element('div', {
                        classes: [
                          arr.has('tox-menu-nav__js'),
                          arr.has('tox-collection__item')
                        ],
                        attrs: {
                          title: str.is('Lower Roman'),
                        },
                        children: [
                          s.element('div', {
                            classes: [ arr.has('tox-collection__item-icon') ]
                          })
                        ]
                      }),
                      s.element('div', {
                        classes: [
                          arr.has('tox-menu-nav__js'),
                          arr.has('tox-collection__item')
                        ],
                        attrs: {
                          title: str.is('Upper Alpha'),
                        },
                        children: [
                          s.element('div', {
                            classes: [ arr.has('tox-collection__item-icon') ]
                          })
                        ]
                      }),
                      s.element('div', {
                        classes: [
                          arr.has('tox-menu-nav__js'),
                          arr.has('tox-collection__item')
                        ],
                        attrs: {
                          title: str.is('Upper Roman'),
                        },
                        children: [
                          s.element('div', {
                            classes: [ arr.has('tox-collection__item-icon') ]
                          })
                        ]
                      })
                    ]
                  })
                ]
              })
            ]
          });
        }),
        Element.fromDom(document.querySelector('.tox-tiered-menu'))
      );
    });
  };

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    Pipeline.async({}, [

      clickOnSplitBtnFor('Numbered list'),
      assertNumListStructure(),
      Keyboard.sKeydown(Element.fromDom(document), Keys.escape(), { }),
      clickOnSplitBtnFor('Bullet list'),
      assertBullListStructure(),

    ], onSuccess, onFailure);
  }, {
    plugins: 'advlist lists',
    advlist_bullet_styles: 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman',
    advlist_number_styles: 'default,circle,square',
    toolbar: 'numlist bullist',
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:SplitButtonTest.ts

示例4: function

UnitTest.asynctest('browser.tinymce.plugins.lists.SplitButtonTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const suite = LegacyUnit.createSuite();

  AdvListPlugin();
  ListsPlugin();
  ModernTheme();

  suite.test('Replace splitbutton control with button when advlist_number_styles/advlist_bullet_styles are empty', function (editor) {
    LegacyUnit.equal(editor.buttons.numlist.type, 'button');
    LegacyUnit.equal(editor.buttons.bullist.type, 'button');
  });

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    Pipeline.async({}, suite.toSteps(editor), onSuccess, onFailure);
  }, {
    plugins: 'advlist lists',
    advlist_bullet_styles: '',
    advlist_number_styles: '',
    toolbar: 'numlist bullist',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:24,代码来源:SplitButtonTest.ts

示例5: function

UnitTest.asynctest('browser.tinymce.plugins.advlist.ChangeListStyleTest', function (success, failure) {
  Theme();
  ListsPlugin();
  AdvlistPlugin();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyUi = TinyUi(editor);
    const sWaitForMenu = () => {
        return Waiter.sTryUntil(
        `Waiting for menu to appear`,
        UiFinder.sExists(Body.body(), '.tox-menu.tox-selected-menu'),
        100,
        1000
      );
    };

    Pipeline.async({}, [
      Logger.t('ul to alpha, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sSetCursor([0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click numlist button', '[aria-label="Numbered list"] > .tox-tbtn + .tox-split-button__chevron'),
        sWaitForMenu(),
        tinyUi.sClickOnUi('click lower alpha item', 'div.tox-selected-menu[role="menu"] div[title="Lower Alpha"]'),
        tinyApis.sAssertContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ul><li>b</li></ul></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('ul to alpha, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click numlist button', '[aria-label="Numbered list"] > .tox-tbtn + .tox-split-button__chevron'),
        sWaitForMenu(),
        tinyUi.sClickOnUi('click lower alpha item', 'div.tox-selected-menu[role="menu"] div[title="Lower Alpha"]'),
        tinyApis.sAssertContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ])),
      Logger.t('ol to ul, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol><li>a</li><ol><li>b</li></ol></ol>'),
        tinyApis.sSetCursor([0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click bullist button', '[aria-label="Bullet list"] > .tox-tbtn'),
        tinyApis.sAssertContent('<ul><li>a</li><ol><li>b</li></ol></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('ol to ul, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol><li>a</li><ol><li>b</li></ol></ol>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click bullist button', '[aria-label="Bullet list"] > .tox-tbtn'),
        tinyApis.sAssertContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ])),
      Logger.t('alpha to ol, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetCursor([0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click numlist button', '[aria-label="Numbered list"] > .tox-tbtn + .tox-split-button__chevron'),
        sWaitForMenu(),
        tinyUi.sClickOnUi('click lower alpha item', 'div.tox-selected-menu[role="menu"] div[title="Default"]'),
        tinyApis.sAssertContent('<ol><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('alpha to ol, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click numlist button', '[aria-label="Numbered list"] > .tox-tbtn + .tox-split-button__chevron'),
        sWaitForMenu(),
        tinyUi.sClickOnUi('click lower alpha item', 'div.tox-selected-menu[role="menu"] div[title="Default"]'),
        tinyApis.sAssertContent('<ol><li>a</li><ol><li>b</li></ol></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ])),
      Logger.t('alpha to ul, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetCursor([0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click numlist button', '[aria-label="Bullet list"] > .tox-tbtn'),
        tinyApis.sAssertContent('<ul><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('alpha to ul, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click numlist button', '[aria-label="Bullet list"] > .tox-tbtn'),
        tinyApis.sAssertContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ]))
    ], onSuccess, onFailure);
  }, {
    indent: false,
    plugins: 'lists advlist',
    toolbar: 'numlist bullist',
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:90,代码来源:ChangeListStyleTest.ts

示例6: function

UnitTest.asynctest('browser.tinymce.plugins.lists.ChangeListStyleTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  ModernTheme();
  ListsPlugin();
  AdvlistPlugin();

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

    Pipeline.async({}, [
      Logger.t('ul to alpha, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sSetCursor([0, 0, 0], 0, [0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click numlist button', 'div[aria-label="Numbered list"] button.mce-open'),
        tinyUi.sClickOnUi('click lower alpha item', 'div[role="menuitem"] span:contains("Lower Alpha")'),
        tinyApis.sAssertContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ul><li>b</li></ul></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('ul to alpha, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click numlist button', 'div[aria-label="Numbered list"] button.mce-open'),
        tinyUi.sClickOnUi('click lower alpha item', 'div[role="menuitem"] span:contains("Lower Alpha")'),
        tinyApis.sAssertContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ])),
      Logger.t('ol to ul, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol><li>a</li><ol><li>b</li></ol></ol>'),
        tinyApis.sSetCursor([0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click bullist button', 'div[aria-label="Bullet list"] > button'),
        tinyApis.sAssertContent('<ul><li>a</li><ol><li>b</li></ol></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('ol to ul, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol><li>a</li><ol><li>b</li></ol></ol>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click bullist button', 'div[aria-label="Bullet list"] > button'),
        tinyApis.sAssertContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ])),
      Logger.t('alpha to ol, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetCursor([0, 0, 0], 0, [0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click numlist button', 'div[aria-label="Numbered list"] button.mce-open'),
        tinyUi.sClickOnUi('click lower alpha item', 'div[role="menuitem"] span:contains("Default")'),
        tinyApis.sAssertContent('<ol><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('alpha to ol, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click numlist button', 'div[aria-label="Numbered list"] button.mce-open'),
        tinyUi.sClickOnUi('click lower alpha item', 'div[role="menuitem"] span:contains("Default")'),
        tinyApis.sAssertContent('<ol><li>a</li><ol><li>b</li></ol></ol>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ])),
      Logger.t('alpha to ul, cursor only in parent', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetCursor([0, 0, 0], 0, [0, 0, 0], 0),
        tinyUi.sClickOnToolbar('click numlist button', 'div[aria-label="Bullet list"] > button'),
        tinyApis.sAssertContent('<ul><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 0, 0], 0)
      ])),
      Logger.t('alpha to ul, selection from parent to sublist', GeneralSteps.sequence([
        tinyApis.sSetContent('<ol style="list-style-type: lower-alpha;"><li>a</li><ol style="list-style-type: lower-alpha;"><li>b</li></ol></ol>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 1, 0, 0], 1),
        tinyUi.sClickOnToolbar('click numlist button', 'div[aria-label="Bullet list"] > button'),
        tinyApis.sAssertContent('<ul><li>a</li><ul><li>b</li></ul></ul>'),
        tinyApis.sAssertSelection([0, 0, 0], 0, [0, 1, 0, 0], 1)
      ]))
    ], onSuccess, onFailure);
  }, {
    indent: false,
    plugins: 'lists advlist',
    toolbar: 'numlist bullist',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:81,代码来源:ChangeListStyleTest.ts

示例7: function

UnitTest.asynctest('browser.tinymce.plugins.lists.AdvlistPluginTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const suite = LegacyUnit.createSuite();

  AdvListPlugin();
  ListsPlugin();
  ModernTheme();

  const listStyleTest = function (title, definition) {
    suite.test(title, function (editor) {
      editor.getBody().innerHTML = definition.inputContent;
      LegacyUnit.setSelection(editor, definition.inputSelection[0], definition.inputSelection[1]);
      editor.execCommand(definition.command, false, { 'list-style-type': definition.listType });
      const rng = editor.selection.getRng(true);
      const expectedElm = editor.dom.select(definition.expectedSelection[0])[0];

      LegacyUnit.equal(editor.getContent(), definition.expectedContent, 'Editor content should be equal');
      LegacyUnit.equalDom(rng.startContainer.parentNode, expectedElm, 'Selection elements should be equal');
      LegacyUnit.equal(rng.startOffset, definition.expectedSelection[1], 'Selection offset should be equal');
    });
  };

  listStyleTest('Apply unordered list style to an unordered list', {
    inputContent: '<ul><li>a</li></ul>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyUnorderedListStyle',
    listType: 'disc',
    expectedContent: '<ul style="list-style-type: disc;"><li>a</li></ul>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply ordered list style to an ordered list', {
    inputContent: '<ol><li>a</li></ol>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyOrderedListStyle',
    listType: 'lower-roman',
    expectedContent: '<ol style="list-style-type: lower-roman;"><li>a</li></ol>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply unordered list style to an unordered list', {
    inputContent: '<ol><li>a</li></ol>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyUnorderedListStyle',
    listType: 'disc',
    expectedContent: '<ul style="list-style-type: disc;"><li>a</li></ul>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply unordered list style to an unordered list with a child unordered list', {
    inputContent: '<ul><li>a<ul><li>b</li></ul></li></ul>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyUnorderedListStyle',
    listType: 'disc',
    expectedContent: '<ul style="list-style-type: disc;"><li>a<ul><li>b</li></ul></li></ul>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply ordered list style to an ordered list with a child ordered list', {
    inputContent: '<ol><li>a<ol><li>b</li></ol></li></ol>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyOrderedListStyle',
    listType: 'lower-roman',
    expectedContent: '<ol style="list-style-type: lower-roman;"><li>a<ol><li>b</li></ol></li></ol>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply unordered list style to an unordered list with a child ordered list', {
    inputContent: '<ul><li>a<ol><li>b</li></ol></li></ul>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyUnorderedListStyle',
    listType: 'disc',
    expectedContent: '<ul style="list-style-type: disc;"><li>a<ol><li>b</li></ol></li></ul>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply ordered list style to an unordered list with a child unordered list', {
    inputContent: '<ol><li>a<ul><li>b</li></ul></li></ol>',
    inputSelection: ['li:nth-child(1)', 0],
    command: 'ApplyOrderedListStyle',
    listType: 'lower-roman',
    expectedContent: '<ol style="list-style-type: lower-roman;"><li>a<ul><li>b</li></ul></li></ol>',
    expectedSelection: ['li:nth-child(1)', 0]
  });

  listStyleTest('Apply unordered list style to an unordered list with a child unordered list', {
    inputContent: '<ul><li>a<ul><li>b</li></ul></li></ul>',
    inputSelection: ['li:nth-child(1) > ul > li:nth-child(1)', 0],
    command: 'ApplyUnorderedListStyle',
    listType: 'disc',
    expectedContent: '<ul><li>a<ul style="list-style-type: disc;"><li>b</li></ul></li></ul>',
    expectedSelection: ['li:nth-child(1) > ul > li:nth-child(1)', 0]
  });

  listStyleTest('Apply ordered list style to an ordered list with a child ordered list', {
    inputContent: '<ol><li>a<ol><li>b</li></ol></li></ol>',
    inputSelection: ['li:nth-child(1) > ol > li:nth-child(1)', 0],
    command: 'ApplyOrderedListStyle',
    listType: 'lower-roman',
//.........这里部分代码省略.........
开发者ID:abstask,项目名称:tinymce,代码行数:101,代码来源:AdvlistPluginTest.ts

示例8:

import PrintPlugin from 'tinymce/plugins/print/Plugin';
import SavePlugin from 'tinymce/plugins/save/Plugin';
import SearchReplacePlugin from 'tinymce/plugins/searchreplace/Plugin';
import SpellCheckerPlugin from 'tinymce/plugins/spellchecker/Plugin';
import TabFocusPlugin from 'tinymce/plugins/tabfocus/Plugin';
import TablePlugin from 'tinymce/plugins/table/Plugin';
import TemplatePlugin from 'tinymce/plugins/template/Plugin';
import TextColorPlugin from 'tinymce/plugins/textcolor/Plugin';
import TextPatternPlugin from 'tinymce/plugins/textpattern/Plugin';
import TocPlugin from 'tinymce/plugins/toc/Plugin';
import VisualBlocksPlugin from 'tinymce/plugins/visualblocks/Plugin';
import VisualCharsPlugin from 'tinymce/plugins/visualchars/Plugin';
import WordCountPlugin from 'tinymce/plugins/wordcount/Plugin';
import ModernTheme from 'tinymce/themes/modern/Theme';

AdvListPlugin();
AnchorPlugin();
AutoLinkPlugin();
AutoResizePlugin();
AutoSavePlugin();
BbCodePlugin();
CharMapPlugin();
CodePlugin();
CodeSamplePlugin();
ColorPickerPlugin();
ContextMenuPlugin();
DirectionalityPlugin();
EmoticonsPlugin();
FullPagePlugin();
FullScreenPlugin();
HrPlugin();
开发者ID:howardjing,项目名称:tinymce,代码行数:31,代码来源:Demo.ts


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