本文整理汇总了TypeScript中tinymce/core/api/PluginManager.add函数的典型用法代码示例。如果您正苦于以下问题:TypeScript add函数的具体用法?TypeScript add怎么用?TypeScript add使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Theme
UnitTest.asynctest('browser.tinymce.core.init.InitEditorPluginInitErrorTest', (success, failure) => {
Theme();
PluginManager.add('errorplugin', () => {
throw new Error('Failed to initialize plugin');
});
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'Editor is responsive after using a plugin that throws an error during init', [
tinyApis.sSetContent('<p>a</p>'),
tinyApis.sAssertContent('<p>a</p>'),
]),
Log.step('TBA', 'Failed plugin shouldn\'t be registered', Step.sync(() => {
Assertions.assertEq('Plugin shouldn\'t be registered', undefined, editor.plugins.errorplugin);
})),
Log.step('TBA', 'Notification opened detailing plugin failed to init', Step.sync(() => {
const notifications = editor.notificationManager.getNotifications();
Assertions.assertEq('Notification should exist', 1, notifications.length);
const notification = notifications[0];
Assertions.assertEq('Notification should have a message', 'Failed to initialize plugin: errorplugin', notification.settings.text);
Assertions.assertEq('Notification should be an error', 'error', notification.settings.type);
notification.close();
}))
], onSuccess, onFailure);
}, {
skin_url: '/project/js/tinymce/skins/lightgray',
plugins: 'errorplugin'
}, success, failure);
});
示例2: function
function () {
// Fake loading of tinymcespellchecker
PluginManager.add('tinymcespellchecker', function () { });
Assertions.assertEq('Should not have pro plugin', false, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste' }, EditorManager)));
Assertions.assertEq('Should not have pro plugin', false, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: '' }, EditorManager)));
Assertions.assertEq('Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'tinymcespellchecker' }, EditorManager)));
Assertions.assertEq('Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste tinymcespellchecker' }, EditorManager)));
Assertions.assertEq('Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'tinymcespellchecker paste' }, EditorManager)));
Assertions.assertEq('Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste tinymcespellchecker paste' }, EditorManager)));
Assertions.assertEq('Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste,tinymcespellchecker,paste' }, EditorManager)));
Assertions.assertEq('Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste tinymcespellchecker paste' }, EditorManager)));
}
示例3: function
UnitTest.test('browser.tinymce.plugins.paste.alien.DetectProPluginTest', function () {
// Fake loading of powerpaste
PluginManager.add('powerpaste', function () { });
Assertions.assertEq('TestCase-TBA: Paste: Should not have pro plugin', false, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should not have pro plugin', false, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: '' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'powerpaste' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste powerpaste' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'powerpaste paste' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste powerpaste paste' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste,powerpaste,paste' }, EditorManager)));
Assertions.assertEq('TestCase-TBA: Paste: Should have pro plugin', true, DetectProPlugin.hasProPlugin(new Editor('id', { plugins: 'paste powerpaste paste' }, EditorManager)));
});
示例4: function
/**
* Plugin.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 { Cell } from '@ephox/katamari';
import PluginManager from 'tinymce/core/api/PluginManager';
import Commands from './api/Commands';
import Buttons from './ui/Buttons';
PluginManager.add('insertdatetime', function (editor) {
const lastFormatState = Cell(null);
Commands.register(editor);
Buttons.register(editor, lastFormatState);
});
export default function () { }
示例5: function
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import PluginManager from 'tinymce/core/api/PluginManager';
import Api from './api/Api';
import Commands from './api/Commands';
import FilterContent from './core/FilterContent';
import ResolveName from './core/ResolveName';
import Selection from './core/Selection';
import Buttons from './ui/Buttons';
PluginManager.add('media', function (editor) {
Commands.register(editor);
Buttons.register(editor);
ResolveName.setup(editor);
FilterContent.setup(editor);
Selection.setup(editor);
return Api.get(editor);
});
export default function () { }
示例6: function
/**
* Plugin.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 PluginManager from 'tinymce/core/api/PluginManager';
import Formats from './core/Formats';
import Buttons from './ui/Buttons';
/**
* This class contains all core logic for the legacyoutput plugin.
*
* @class tinymce.legacyoutput.Plugin
* @private
*/
PluginManager.add('legacyoutput', function (editor) {
Formats.setup(editor);
Buttons.register(editor);
});
export default function () { }
示例7: function
/**
* Plugin.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 PluginManager from 'tinymce/core/api/PluginManager';
import Commands from './api/Commands';
import FilterContent from './core/FilterContent';
import Buttons from './ui/Buttons';
PluginManager.add('image', function (editor) {
FilterContent.setup(editor);
Buttons.register(editor);
Commands.register(editor);
});
export default function () { }
示例8: function
/**
* Plugin.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 PluginManager from 'tinymce/core/api/PluginManager';
import Api from './api/Api';
import ImportCss from './core/ImportCss';
PluginManager.add('importcss', function (editor) {
ImportCss.setup(editor);
return Api.get(editor);
});
export default function () { }
示例9: function
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import { Cell } from '@ephox/katamari';
import PluginManager from 'tinymce/core/api/PluginManager';
import Commands from './api/Commands';
import Bindings from './core/Bindings';
import Buttons from './ui/Buttons';
PluginManager.add('visualblocks', (editor, pluginUrl) => {
const enabledState = Cell(false);
Commands.register(editor, pluginUrl, enabledState);
Buttons.register(editor, enabledState);
Bindings.setup(editor, pluginUrl, enabledState);
});
export default function () { }
示例10: function
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
import PluginManager from 'tinymce/core/api/PluginManager';
import Commands from './api/Commands';
import Buttons from './ui/Buttons';
PluginManager.add('directionality', function (editor) {
Commands.register(editor);
Buttons.register(editor);
});
export default function () { }