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


TypeScript Plugin.default函数代码示例

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


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

  EditorManager.init({
    selector: '.tiny-text',
    theme: 'mobile',
    toolbar: [ 'styleselect', 'undo', 'redo', 'bold', 'bold', 'italic', 'underline', 'styleselect', 'removeformat', 'link', 'unlink', 'image', 'fontsizeselect', 'bullist', 'numlist', 'forecolor' ],
    plugins: [
      'lists', // Required for list functionality (commands),
      'autolink', // Required for turning pasted text into hyperlinks
      'autosave' // Required to prevent users losing content when they press back
    ],
    skin_url: '../../../../../js/tinymce/skins/lightgray',

    setup (ed) {
      ed.on('skinLoaded', function () {
        // Notification fields for equality: type, text, progressBar, timeout
        ed.notificationManager.open({
          text: 'You will not see this because the mobile theme has no notifications',
          type: 'info'
        });
      });
    },

    style_formats: [
      {
        title: 'Headings', items: [
          { title: 'Heading 1', format: 'h1' },
          { title: 'Heading 2', format: 'h2' },
          { title: 'Heading 3', format: 'h3' },
          { title: 'Heading 4', format: 'h4' },
          { title: 'Heading 5', format: 'h5' },
          { title: 'Heading 6', format: 'h6' }
        ]
      },

      {
        title: 'Inline', items: [
          { title: 'Bold', icon: 'bold', format: 'bold' },
          { title: 'Italic', icon: 'italic', format: 'italic' },
          { title: 'Underline', icon: 'underline', format: 'underline' },
          { title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough' },
          { title: 'Superscript', icon: 'superscript', format: 'superscript' },
          { title: 'Subscript', icon: 'subscript', format: 'subscript' },
          { title: 'Code', icon: 'code', format: 'code' }
        ]
      },

      {
        // Should not appear when not in a table.
        title: 'Table', items: [
          { title: 'Rows', items: [
            { title: 'Cell', selector: 'tr', styles: { background: 'red' } }
          ] }
        ]
      },

      {
        title: 'Blocks', items: [
          { title: 'Paragraph', format: 'p', selector: 'address' },
          { title: 'Blockquote', format: 'blockquote', selector: 'address' },
          { title: 'Div', format: 'div', selector: 'address' },
          { title: 'Pre', format: 'pre', selector: 'address' }
        ]
      },

      {
        title: 'Alignment', items: [
          { title: 'Left', icon: 'alignleft', format: 'alignleft' },
          { title: 'Center', icon: 'aligncenter', format: 'aligncenter' },
          { title: 'Right', icon: 'alignright', format: 'alignright' },
          { title: 'Justify', icon: 'alignjustify', format: 'alignjustify' }
        ]
      }
    ]
  });
}
开发者ID:howardjing,项目名称:tinymce,代码行数:80,代码来源:Demo.ts

示例3: function


//.........这里部分代码省略.........

  const typeNewlineURL = function (editor, url) {
    editor.setContent('<p>' + url + '</p>');
    LegacyUnit.setSelection(editor, 'p', url.length);
    KeyUtils.type(editor, '\n');
    return editor.getContent();
  };

  suite.test('Urls ended with space', function (editor) {
    editor.focus();
    LegacyUnit.equal(typeUrl(editor, 'http://www.domain.com'), '<p><a href="http://www.domain.com">http://www.domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'https://www.domain.com'), '<p><a href="https://www.domain.com">https://www.domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'ssh://www.domain.com'), '<p><a href="ssh://www.domain.com">ssh://www.domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'ftp://www.domain.com'), '<p><a href="ftp://www.domain.com">ftp://www.domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'www.domain.com'), '<p><a href="http://www.domain.com">www.domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'www.domain.com.'), '<p><a href="http://www.domain.com">www.domain.com</a>.&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'user@domain.com'), '<p><a href="mailto:user@domain.com">user@domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'mailto:user@domain.com'), '<p><a href="mailto:user@domain.com">mailto:user@domain.com</a>&nbsp;</p>');
    LegacyUnit.equal(typeUrl(editor, 'first-last@domain.com'), '<p><a href="mailto:first-last@domain.com">first-last@domain.com</a>&nbsp;</p>');
  });

  suite.test('Urls ended with )', function (editor) {
    LegacyUnit.equal(
      typeAnEclipsedURL(editor, 'http://www.domain.com'),
      '<p>(<a href="http://www.domain.com">http://www.domain.com</a>)</p>'
    );
    LegacyUnit.equal(
      typeAnEclipsedURL(editor, 'https://www.domain.com'),
      '<p>(<a href="https://www.domain.com">https://www.domain.com</a>)</p>'
    );
    LegacyUnit.equal(
      typeAnEclipsedURL(editor, 'ssh://www.domain.com'),
      '<p>(<a href="ssh://www.domain.com">ssh://www.domain.com</a>)</p>'
    );
    LegacyUnit.equal(
      typeAnEclipsedURL(editor, 'ftp://www.domain.com'),
      '<p>(<a href="ftp://www.domain.com">ftp://www.domain.com</a>)</p>'
    );
    LegacyUnit.equal(typeAnEclipsedURL(editor, 'www.domain.com'), '<p>(<a href="http://www.domain.com">www.domain.com</a>)</p>');
    LegacyUnit.equal(typeAnEclipsedURL(editor, 'www.domain.com.'), '<p>(<a href="http://www.domain.com">www.domain.com</a>.)</p>');
  });

  suite.test('Urls ended with new line', function (editor) {
    LegacyUnit.equal(
      typeNewlineURL(editor, 'http://www.domain.com'),
      '<p><a href="http://www.domain.com">http://www.domain.com</a></p><p>&nbsp;</p>'
    );
    LegacyUnit.equal(
      typeNewlineURL(editor, 'https://www.domain.com'),
      '<p><a href="https://www.domain.com">https://www.domain.com</a></p><p>&nbsp;</p>'
    );
    LegacyUnit.equal(
      typeNewlineURL(editor, 'ssh://www.domain.com'),
      '<p><a href="ssh://www.domain.com">ssh://www.domain.com</a></p><p>&nbsp;</p>'
    );
    LegacyUnit.equal(
      typeNewlineURL(editor, 'ftp://www.domain.com'),
      '<p><a href="ftp://www.domain.com">ftp://www.domain.com</a></p><p>&nbsp;</p>'
    );
    LegacyUnit.equal(
      typeNewlineURL(editor, 'www.domain.com'),
      '<p><a href="http://www.domain.com">www.domain.com</a></p><p>&nbsp;</p>'
    );
    LegacyUnit.equal(
      typeNewlineURL(editor, 'www.domain.com.'),
      '<p><a href="http://www.domain.com">www.domain.com</a>.</p><p>&nbsp;</p>'
    );
  });

  suite.test('Url inside blank formatting wrapper', function (editor) {
    editor.focus();
    editor.setContent('<p><br></p>');
    editor.selection.setCursorLocation(editor.getBody().firstChild, 0);
    editor.execCommand('Bold');
    // inserting url via typeUrl() results in different behaviour, so lets simply type it in, char by char
    KeyUtils.typeString(editor, 'http://www.domain.com ');
    LegacyUnit.equal(
      editor.getContent(),
      '<p><strong><a href="http://www.domain.com">http://www.domain.com</a>&nbsp;</strong></p>'
    );
  });

  suite.test('default_link_target=\'_self\'', function (editor) {
    editor.settings.default_link_target = '_self';
    LegacyUnit.equal(
      typeUrl(editor, 'http://www.domain.com'),
      '<p><a href="http://www.domain.com" target="_self">http://www.domain.com</a>&nbsp;</p>'
    );
    delete editor.settings.default_link_target;
  });

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const steps = Env.ie ? [] : suite.toSteps(editor);
    Pipeline.async({}, steps, onSuccess, onFailure);
  }, {
    plugins: 'autolink',
    indent: false,
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:AutoLinkPluginTest.ts

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

示例5: function

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

  ModernTheme();
  AutolinkPlugin();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const steps = Env.ie ? [] : [
      tinyApis.sFocus,
      Logger.t('Chrome adds a nbsp between link and text', GeneralSteps.sequence([
        tinyApis.sSetContent('<p><a href="http://www.domain.com">www.domain.com</a>&nbsp;www.domain.com</p>'),
        tinyApis.sSetCursor([0, 1], 15),
        Step.sync(function () {
          KeyUtils.type(editor, ' ');
        }),
        tinyApis.sAssertContent('<p><a href="http://www.domain.com">www.domain.com</a>&nbsp;<a href="http://www.domain.com">www.domain.com</a>&nbsp;</p>')
      ])),
      Logger.t('FireFox does not seem to add a nbsp between link and text', GeneralSteps.sequence([
        tinyApis.sSetContent('<p><a href="http://www.domain.com">www.domain.com</a> www.domain.com</p>'),
        tinyApis.sSetCursor([0, 1], 15),
        Step.sync(function () {
          KeyUtils.type(editor, ' ');
        }),
        tinyApis.sAssertContent('<p><a href="http://www.domain.com">www.domain.com</a> <a href="http://www.domain.com">www.domain.com</a>&nbsp;</p>')
      ]))
    ];

    Pipeline.async({}, steps, onSuccess, onFailure);
  }, {
    plugins: 'autolink',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:35,代码来源:ConsecutiveLinkTest.ts

示例6: function

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

  ModernTheme();
  AutoLinkPlugin();

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

    Pipeline.async({}, [
      tinyApis.sFocus,
      tinyApis.sSetContent('<p>abcdefghijk</p>'),
      tinyApis.sSetCursor([0, 0], 11),
      tinyActions.sContentKeystroke(Keys.enter(), {}),
      Step.sync(function () {
        try {
          editor.fire('keydown', { keyCode: 13 });
        } catch (error) {
          Assertions.assertEq('should not throw error', true, false);
        }
      })
    ], onSuccess, onFailure);
  }, {
    plugins: 'autolink',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:29,代码来源:EnterKeyTest.ts

示例7: Theme

UnitTest.asynctest('browser.tinymce.plugins.autolink.EnterKeyTest', (success, failure) => {

  Theme();
  AutoLinkPlugin();

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

    Pipeline.async({},
      Log.steps('TINY-1202', 'AutoLink: Focus on editor, set content, set cursor at end of content, assert enter/return keystroke and keydown event', [
        tinyApis.sFocus,
        tinyApis.sSetContent('<p>abcdefghijk</p>'),
        tinyApis.sSetCursor([0, 0], 'abcdefghijk'.length),
        tinyActions.sContentKeystroke(Keys.enter(), {}),
        Step.sync(function () {
          try {
            editor.fire('keydown', { keyCode: 13 });
          } catch (error) {
            Assertions.assertEq('should not throw error', true, false);
          }
        }),
    ]), onSuccess, onFailure);
  }, {
    plugins: 'autolink',
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:28,代码来源:EnterKeyTest.ts

示例8: Theme

UnitTest.asynctest('browser.tinymce.plugins.autolink.ConsecutiveLinkTest', (success, failure) => {

  Theme();
  AutolinkPlugin();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const steps = Env.ie ? [] : [
      tinyApis.sFocus,
      Log.stepsAsStep('TBA', 'AutoLink: Chrome adds a nbsp between link and text', [
        tinyApis.sSetContent('<p><a href="http://www.domain.com">www.domain.com</a>&nbsp;www.domain.com</p>'),
        tinyApis.sSetCursor([0, 1], 15),
        Step.sync(function () {
          KeyUtils.type(editor, ' ');
        }),
        tinyApis.sAssertContent('<p><a href="http://www.domain.com">www.domain.com</a>&nbsp;<a href="http://www.domain.com">www.domain.com</a>&nbsp;</p>')
      ]),
      Log.stepsAsStep('TBA', 'AutoLink: FireFox does not seem to add a nbsp between link and text', [
        tinyApis.sSetContent('<p><a href="http://www.domain.com">www.domain.com</a> www.domain.com</p>'),
        tinyApis.sSetCursor([0, 1], 15),
        Step.sync(function () {
          KeyUtils.type(editor, ' ');
        }),
        tinyApis.sAssertContent('<p><a href="http://www.domain.com">www.domain.com</a> <a href="http://www.domain.com">www.domain.com</a>&nbsp;</p>')
      ])
    ];

    Pipeline.async({}, steps, onSuccess, onFailure);
  }, {
    plugins: 'autolink',
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:33,代码来源:ConsecutiveLinkTest.ts

示例9:

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

import AutoLinkPlugin from 'tinymce/plugins/autolink/Plugin';

declare let tinymce: any;

AutoLinkPlugin();

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


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