• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript Plugin.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了default函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: Plugin

UnitTest.asynctest('browser.tinymce.plugins.importcss.ImportCssTest', (success, failure) => {

  Plugin();
  Theme();

  const sTestEditorWithSettings = (assertions, pluginSettings) => Step.async((onStepSuccess, onStepFailure) => {
    TinyLoader.setup((editor, onSuccess, onFailure) => {

      const tinyUi = TinyUi(editor);

      const sAssertMenu = (label: string, expected, hasIcons) => {
        return Chain.asStep(Body.body(), [
          UiFinder.cWaitForVisible('Waiting for styles menu to appear', '[role="menu"]'),
          Assertions.cAssertStructure('Checking structure', ApproxStructure.build((s, str, arr) => {
            return s.element('div', {
              classes: [ arr.has('tox-menu') ],
              children: [
                s.element('div', {
                  classes: [ arr.has('tox-collection__group') ],
                  children: Arr.map(expected, (exp) => {
                    return s.element('div', {
                      classes: [ arr.has('tox-collection__item') ],
                      children: [
                        ...hasIcons ? [ s.element('div', { classes: [ arr.has('tox-collection__item-icon') ]}) ] : [ ],
                        s.element('div', exp.submenu ? {
                          classes: [ arr.has('tox-collection__item-label') ],
                          html: str.is(exp.html)
                        } : {
                          classes: [ arr.has('tox-collection__item-label') ],
                          children: [
                            s.element(exp.tag, { html: str.is(exp.html) })
                          ]
                        })
                      ].concat(exp.submenu ? [ s.anything() ] : [ ])
                    });
                  })
                })
              ]
            });
          }))
        ]);
      };

      const sOpenStyleMenu = GeneralSteps.sequence([
        tinyUi.sClickOnToolbar('Clicking on the styleselect dropdown', 'button')
      ]);

      Pipeline.async({}, [
        sOpenStyleMenu,
        sAssertMenu('Checking stuff', assertions.menuContents, assertions.menuHasIcons)
      ].concat(assertions.choice.map((c) => [
          Assertions.sAssertPresence(
            `${c} should NOT be present before clicking`,
            {
              [c]: 0
            },
            Element.fromDom(editor.getBody())
          ),
          Mouse.sClickOn(Body.body(), `.tox-collection__item .tox-collection__item-label:contains(${c})`),
          Assertions.sAssertPresence(
            `${c} should be present`,
            {
              [c]: 1
            },
            Element.fromDom(editor.getBody())
          )
        ]).getOr([ ])), onSuccess, onFailure);
    }, {
      plugins: 'importcss',
      toolbar: 'styleselect',
      theme: 'silver',
      content_css: pluginSettings.content_css,
      importcss_append: pluginSettings.importcss_append,
      importcss_selector_filter: pluginSettings.importcss_selector_filter,
      importcss_file_filter: pluginSettings.importcss_file_filter,
      importcss_groups: pluginSettings.importcss_groups,
      importcss_selector_converter: pluginSettings.importcss_selector_converter,
      importcss_exclusive: pluginSettings.importcss_exclusive,
      base_url: '/project/tinymce/js/tinymce'
    }, () => onStepSuccess(), onStepFailure);
  });

  Pipeline.async({ }, [
    Log.step(
      'TBA',
      'importcss: content_css with one file, append default',
      sTestEditorWithSettings(
        {
          menuContents: [
            { tag: 'h1', html: 'h1.red', submenu: false },
            { tag: 'p', html: 'p.other', submenu: false },
            { tag: 'span', html: 'span.inline', submenu: false }
          ],
          menuHasIcons: true,
          choice: Option.some('h1.red')
        },
        {
          content_css: [ '/project/tinymce/src/plugins/importcss/test/css/basic.css' ],
          importcss_append: undefined
        }
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:ImportCssPluginTest.ts


示例4: function

UnitTest.asynctest('browser.tinymce.plugins.importcss.ImportCssPluginTest.js', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const suite = LegacyUnit.createSuite();
  let menuCtrl;

  ModernTheme();
  ImportCssPlugin();

  const fireFormatsMenuEvent = function (editor: Editor, styleSheets, items?) {
    menuCtrl = Factory.create('menu', {
      items
    }).renderTo(document.getElementById('view'));

    return editor.fire('renderFormatsMenu', {
      control: menuCtrl,
      doc: {
        styleSheets
      }
    });
  };

  const getMenuItemFormat = function (editor: Editor, item) {
    return editor.formatter.get(item.settings.format)[0];
  };

  const sTeardown = function (editor: Editor) {
    return Step.sync(function () {
      if (menuCtrl) {
        menuCtrl.remove();
        menuCtrl = null;
      }

      editor.contentCSS = [];
      delete editor.settings.importcss_file_filter;
      delete editor.settings.importcss_merge_classes;
      delete editor.settings.importcss_append;
      delete editor.settings.importcss_selector_filter;
      delete editor.settings.importcss_groups;
      delete editor.settings.importcss_exclusive;
      delete editor.settings.importcss_selector_converter;
    });
  };

  const appendTeardown = function (editor: Editor, steps) {
    return Arr.bind(steps, function (step) {
      return [step, sTeardown(editor)];
    });
  };

  suite.test('Import content_css files', function (editor: Editor) {
    editor.contentCSS.push('test1.css');
    editor.contentCSS.push('test2.css');

    const evt = fireFormatsMenuEvent(editor, [
      {
        href: 'test1.css',
        cssRules: [
          { selectorText: '.a' },
          { selectorText: 'p.b' },
          { selectorText: 'img.c' }
        ]
      },

      { href: 'test2.css', cssRules: [{ selectorText: '.d' }] },
      { href: 'test3.css', cssRules: [{ selectorText: '.e' }] }
    ]);

    LegacyUnit.equal(evt.control.items().length, 4);

    LegacyUnit.equal(evt.control.items()[0].text(), 'a');
    LegacyUnit.equal(getMenuItemFormat(editor, evt.control.items()[0]).classes, ['a']);

    LegacyUnit.equal(evt.control.items()[1].text(), 'p.b');
    LegacyUnit.equal(getMenuItemFormat(editor, evt.control.items()[1]).block, 'p');
    LegacyUnit.equal(getMenuItemFormat(editor, evt.control.items()[1]).classes[0], 'b');

    LegacyUnit.equal(evt.control.items()[2].text(), 'img.c');
    LegacyUnit.equal(getMenuItemFormat(editor, evt.control.items()[2]).selector, 'img');
    LegacyUnit.equal(getMenuItemFormat(editor, evt.control.items()[2]).classes[0], 'c');

    LegacyUnit.equal(evt.control.items()[3].text(), 'd');
  });

  suite.test('Import custom importcss_merge_classes: false', function (editor: Editor) {
    editor.contentCSS.push('test.css');
    editor.settings.importcss_merge_classes = false;

    const evt = fireFormatsMenuEvent(editor, [
      { href: 'test.css', cssRules: [{ selectorText: '.a' }] }
    ]);

    LegacyUnit.equal(evt.control.items().length, 1);
    LegacyUnit.equal(getMenuItemFormat(editor, evt.control.items()[0]).attributes, { class: 'a' });
  });

  suite.test('Import contentCSS with querystring', function (editor: Editor) {
    editor.contentCSS.push('test.css?hello');

    const evt = fireFormatsMenuEvent(editor, [
//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:ImportCssPluginTest.ts


示例5:

/**
 * Demo.js
 *
 * Released under LGPL License.
 * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

import ImportCssPlugin from 'tinymce/plugins/importcss/Plugin';

declare let tinymce: any;

ImportCssPlugin();

const elm: any = document.querySelector('.tinymce');
elm.value = 'The format menu should show "red"';

tinymce.init({
  selector: 'textarea.tinymce',
  theme: 'modern',
  skin_url: '../../../../../js/tinymce/skins/lightgray',
  plugins: 'importcss code',
  toolbar: 'styleselect code',
  height: 600,
  content_css: '../css/rules.css'
});
开发者ID:howardjing,项目名称:tinymce,代码行数:28,代码来源:Demo.ts


示例6: Plugin

UnitTest.asynctest('browser.tinymce.plugins.importcss.ImportCssGroupsTest', (success, failure) => {

  Plugin();
  Theme();

  const sTestEditorWithSettings = (assertions, pluginSettings) => Step.async((onStepSuccess, onStepFailure) => {
    TinyLoader.setup((editor, onSuccess, onFailure) => {
      const doc = Element.fromDom(document);

      const tinyUi = TinyUi(editor);

      const sOpenStyleMenu = GeneralSteps.sequence([
        tinyUi.sClickOnToolbar('Clicking on the styleselect dropdown', 'button')
      ]);

      const navigationSteps = MenuNavigationTestUtils.generateNavigation(doc, assertions.navigation);

      Pipeline.async({}, Arr.flatten([
        [
          Assertions.sAssertPresence(
            `${assertions.choice.presence} should NOT be present`,
            {
              [assertions.choice.presence]: 0
            },
            Element.fromDom(editor.getBody())
          )
        ],
        [ sOpenStyleMenu ],
        navigationSteps,
        Arr.map(assertions.choice.keysBeforeExecute, (k) => Keyboard.sKeydown(doc, k, { })),
        [ Keyboard.sKeydown(doc, Keys.enter(), { }) ],
        [
          Assertions.sAssertPresence(
            `${assertions.choice.presence} should now be present`,
            {
              [assertions.choice.presence]: 1
            },
            Element.fromDom(editor.getBody())
          )
        ]
      ]), onSuccess, onFailure);
    }, {
      plugins: 'importcss',
      toolbar: 'styleselect',
      theme: 'silver',
      content_css: pluginSettings.content_css,
      importcss_append: pluginSettings.importcss_append,
      importcss_selector_filter: pluginSettings.importcss_selector_filter,
      importcss_file_filter: pluginSettings.importcss_file_filter,
      importcss_groups: pluginSettings.importcss_groups,
      importcss_selector_converter: pluginSettings.importcss_selector_converter,
      importcss_exclusive: pluginSettings.importcss_exclusive,
      base_url: '/project/tinymce/js/tinymce'
    }, () => onStepSuccess(), onStepFailure);
  });

  Pipeline.async({ }, [

    Log.step(
      'TBA',
      'importcss: content_css with three files, append false, groups with overall selector converter',
      sTestEditorWithSettings(
        {
          navigation: [
            { item: 'Other', subitems: [ 'h1.red.DDD', 'p.other.DDD', 'span.inline.DDD' ] },
            { item: 'Advanced', subitems: [ 'h2.advanced.CCC', 'h3.advanced.CCC', 'h4.advanced.CCC' ] }
          ],
          choice: {
            keysBeforeExecute: [ Keys.right() ],
            presence: 'span.converted'
          }
        },
        {
          content_css: [
            '/project/tinymce/src/plugins/importcss/test/css/basic.css',
            '/project/tinymce/src/plugins/importcss/test/css/advanced.css',
            '/project/tinymce/src/plugins/importcss/test/css/other-adv.css'
          ],
          importcss_append: false,
          importcss_groups: [
            { title: 'Advanced', filter: /.adv/, custom: '.CCC' },
            { title: 'Other', custom: '.DDD' }
          ],

          importcss_selector_converter: (selector, group) => {
            return {
              title: selector + group.custom,
              classes: [ 'converted' ],
              inline: 'span'
            };
          }
        }
      )
    ),

    Log.step(
      'TBA',
      'importcss: content_css with three files, append false, groups with group selector converters',
      sTestEditorWithSettings(
        {
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:ImportCssGroupsPluginTest.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript Plugin.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript Plugin.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap