本文整理汇总了TypeScript中tinymce/plugins/searchreplace/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') {
//.........这里部分代码省略.........
示例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'),
//.........这里部分代码省略.........
示例3: Theme
UnitTest.asynctest('browser.tinymce.plugins.searchreplace.SearchReplaceDialogTest', (success, failure) => {
Theme();
SearchreplacePlugin();
TinyLoader.setup((editor, onSuccess, onFailure) => {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'SearchReplace: Test no content selected', [
tinyApis.sSetContent('<p>fish fish fish</p>'),
Utils.sOpenDialog(tinyUi),
Utils.sAssertFieldValue(tinyUi, 'label:contains("Find") + input.tox-textfield', ''),
Utils.sCloseDialog(tinyUi)
]),
Log.stepsAsStep('TBA', 'SearchReplace: Test some content selected', [
tinyApis.sSetContent('<p>fish fish fish</p>'),
tinyApis.sSetSelection([0, 0], 5, [0, 0], 9),
Utils.sOpenDialog(tinyUi),
Utils.sAssertFieldValue(tinyUi, 'label:contains("Find") + input.tox-textfield', 'fish'),
Utils.sCloseDialog(tinyUi)
])
], onSuccess, onFailure);
}, {
plugins: 'searchreplace',
toolbar: 'searchreplace',
base_url: '/project/tinymce/js/tinymce',
theme: 'silver'
}, success, failure);
});
示例4: TinyApis
UnitTest.asynctest('browser.tinymce.plugins.searchreplace.SearchReplacePrevNextTest', (success, failure) => {
Theme();
SearchreplacePlugin();
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({},
Log.steps('TBA', 'SearchReplace: Test Prev and Next buttons become enabled and disabled at right places when multiple matches exist', [
tinyApis.sSetContent('<p>fish fish fish</p>'),
Utils.sOpenDialog(tinyUi),
Chain.asStep({}, [
Chain.fromParent(tinyUi.cWaitForPopup('wait for dialog', 'div[role="dialog"]'), [
Chain.fromChains([
UiFinder.cFindIn('label:contains("Find") + input'),
UiControls.cSetValue('fish')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Find")'),
Mouse.cClick
]),
UiFinder.cFindIn('button[title="Next"]'),
UiFinder.cWaitFor('wait for next button to be enabled', 'button[disabled!="disabled"]'),
Chain.fromChains([
UiFinder.cFindIn('button[title="Next"]'),
Mouse.cClick
]),
UiFinder.cFindIn('button[title="Previous"]'),
UiFinder.cWaitFor('wait for prev button to be enabled', 'button[disabled!="disabled"]'),
Chain.fromChains([
UiFinder.cFindIn('button[title="Next"]'),
Mouse.cClick
]),
UiFinder.cFindIn('button[title="Next"]'),
UiFinder.cWaitFor('wait for next button to be disabled', 'button[disabled="disabled"]'),
Chain.fromChains([
UiFinder.cFindIn('button[title="Previous"]'),
Mouse.cClick,
Mouse.cClick
]),
UiFinder.cFindIn('button[title="Previous"]'),
UiFinder.cWaitFor('wait for prev button to be disabled', 'button[disabled="disabled"]'),
UiFinder.cFindIn('button[title="Next"]'),
UiFinder.cWaitFor('wait for next button to be enabled', 'button[disabled!="disabled"]')
])
])
])
, onSuccess, onFailure);
}, {
plugins: 'searchreplace',
toolbar: 'searchreplace',
base_url: '/project/tinymce/js/tinymce',
theme: 'silver'
}, success, failure);
});
示例5:
/**
* 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 SearchReplacePlugin from 'tinymce/plugins/searchreplace/Plugin';
declare let tinymce: any;
SearchReplacePlugin();
tinymce.init({
selector: 'textarea.tinymce',
theme: 'modern',
skin_url: '../../../../../js/tinymce/skins/lightgray',
plugins: 'searchreplace code',
toolbar: 'searchreplace code',
height: 600
});
示例6: Theme
'browser.tinymce.plugins.searchreplace.SearchReplacePluginTest', (success, failure) => {
const suite = LegacyUnit.createSuite();
Theme();
SearchreplacePlugin();
suite.test('TestCase-TBA: SearchReplace: Find no match', function (editor) {
editor.focus();
editor.setContent('a');
LegacyUnit.equal(0, editor.plugins.searchreplace.find('x'));
});
suite.test('TestCase-TBA: SearchReplace: Find single match', function (editor) {
editor.setContent('a');
LegacyUnit.equal(1, editor.plugins.searchreplace.find('a'));
});
suite.test('TestCase-TBA: SearchReplace: Find single match in multiple elements', function (editor) {
editor.setContent('t<b>e</b><i>xt</i>');
LegacyUnit.equal(1, editor.plugins.searchreplace.find('text'));
});
suite.test('TestCase-TBA: SearchReplace: Find single match, match case: true', function (editor) {
editor.setContent('a A');
LegacyUnit.equal(1, editor.plugins.searchreplace.find('A', true));
});
suite.test('TestCase-TBA: SearchReplace: Find single match, whole words: true', function (editor) {
editor.setContent('a Ax');
LegacyUnit.equal(1, editor.plugins.searchreplace.find('a', false, true));
});
suite.test('TestCase-TBA: SearchReplace: Find multiple matches', function (editor) {
editor.setContent('a b A');
LegacyUnit.equal(2, editor.plugins.searchreplace.find('a'));
});
suite.test('TestCase-TBA: SearchReplace: Find and replace single match', function (editor) {
editor.setContent('a');
editor.plugins.searchreplace.find('a');
LegacyUnit.equal(editor.plugins.searchreplace.replace('x'), false);
LegacyUnit.equal('<p>x</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find and replace first in multiple matches', function (editor) {
editor.setContent('a b a');
editor.plugins.searchreplace.find('a');
LegacyUnit.equal(editor.plugins.searchreplace.replace('x'), true);
LegacyUnit.equal('<p>x b a</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find and replace two consecutive spaces', function (editor) {
editor.setContent('a b');
editor.plugins.searchreplace.find('a ');
LegacyUnit.equal(editor.plugins.searchreplace.replace('x'), false);
LegacyUnit.equal('<p>xb</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find and replace consecutive spaces', function (editor) {
editor.setContent('a b');
editor.plugins.searchreplace.find('a ');
LegacyUnit.equal(editor.plugins.searchreplace.replace('x'), false);
LegacyUnit.equal('<p>xb</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find and replace all in multiple matches', function (editor) {
editor.setContent('a b a');
editor.plugins.searchreplace.find('a');
LegacyUnit.equal(editor.plugins.searchreplace.replace('x', true, true), false);
LegacyUnit.equal('<p>x b x</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find and replace all spaces with new lines', function (editor) {
editor.setContent('a b<br/><br/>ab c');
editor.plugins.searchreplace.find(' ');
LegacyUnit.equal(editor.plugins.searchreplace.replace('x', true, true), false);
LegacyUnit.equal('<p>axxxb<br /><br />abxc</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find multiple matches, move to next and replace', function (editor) {
editor.setContent('a a');
LegacyUnit.equal(2, editor.plugins.searchreplace.find('a'));
editor.plugins.searchreplace.next();
LegacyUnit.equal(editor.plugins.searchreplace.replace('x'), false);
LegacyUnit.equal('<p>a x</p>', editor.getContent());
});
suite.test('TestCase-TBA: SearchReplace: Find and replace fragmented match', function (editor) {
editor.setContent('<b>te<i>s</i>t</b><b>te<i>s</i>t</b>');
editor.plugins.searchreplace.find('test');
LegacyUnit.equal(editor.plugins.searchreplace.replace('abc'), true);
LegacyUnit.equal(editor.getContent(), '<p><b>abc</b><b>te<i>s</i>t</b></p>');
});
suite.test('TestCase-TBA: SearchReplace: Find and replace all fragmented matches', function (editor) {
editor.setContent('<b>te<i>s</i>t</b><b>te<i>s</i>t</b>');
editor.plugins.searchreplace.find('test');
LegacyUnit.equal(editor.plugins.searchreplace.replace('abc', true, true), false);
LegacyUnit.equal(editor.getContent(), '<p><b>abc</b><b>abc</b></p>');
});
//.........这里部分代码省略.........
示例7: Theme
UnitTest.asynctest('browser.tinymce.plugins.searchreplace.UndoReplaceSpanTest', (success, failure) => {
Theme();
SearchreplacePlugin();
const sUndo = function (editor) {
return Logger.t('Undo', Step.sync(function () {
editor.undoManager.undo();
}));
};
const sRedo = function (editor) {
return Logger.t('Redo', Step.sync(function () {
editor.undoManager.redo();
}));
};
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({},
Log.steps('TBA', 'SearchReplace: replace one of three found, undo and redo and assert there is no matcher spans in editor', [
tinyApis.sSetContent('<p>cats cats cats</p>'),
tinyUi.sClickOnToolbar('click on searchreplace button', 'button[aria-label="Find and replace"]'),
Chain.asStep({}, [
Chain.fromParent(tinyUi.cWaitForPopup('wait for dialog', 'div[role="dialog"]'), [
Chain.fromChains([
UiFinder.cFindIn('label:contains("Find") + input'),
UiControls.cSetValue('cats')
]),
Chain.fromChains([
UiFinder.cFindIn('label:contains("Replace with") + input'),
UiControls.cSetValue('dogs')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Find")'),
Mouse.cClick
]),
Chain.fromChains([
UiFinder.cWaitFor('wait for button to be enabled', 'button[disabled!="disabled"]:contains("Replace")')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Replace")'),
Mouse.cClick
]),
Chain.fromChains([
UiFinder.cFindIn('button[aria-label="Close"]'),
Mouse.cClick
])
])
]),
sUndo(editor),
tinyApis.sAssertContent('<p>cats cats cats</p>'),
sRedo(editor),
tinyApis.sAssertContentPresence({ 'span.mce-match-marker': 0 }),
tinyApis.sAssertContent('<p>dogs cats cats</p>')
])
, onSuccess, onFailure);
}, {
plugins: 'searchreplace',
toolbar: 'searchreplace',
base_url: '/project/tinymce/js/tinymce',
theme: 'silver'
}, success, failure);
});
示例8: function
UnitTest.asynctest('browser.tinymce.plugins.searchreplace.UndoReplaceSpanTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
ModernTheme();
SearchreplacePlugin();
const sUndo = function (editor) {
return Step.sync(function () {
editor.undoManager.undo();
});
};
const sRedo = function (editor) {
return Step.sync(function () {
editor.undoManager.redo();
});
};
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Logger.t('replace on of three found, undo and redo and there be no matcher spans in editor', GeneralSteps.sequence([
tinyApis.sSetContent('<p>cats cats cats</p>'),
tinyUi.sClickOnToolbar('click on searchreplace button', 'div[aria-label="Find and replace"] button'),
Chain.asStep({}, [
Chain.fromParent(tinyUi.cWaitForPopup('wait for dialog', 'div[role="dialog"]'), [
Chain.fromChains([
UiFinder.cFindIn('label:contains("Find") + input'),
UiControls.cSetValue('cats')
]),
Chain.fromChains([
UiFinder.cFindIn('label:contains("Replace with") + input'),
UiControls.cSetValue('dogs')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Find")'),
Mouse.cClick
]),
Chain.fromChains([
UiFinder.cWaitFor('wait for button to be enabled', 'div[aria-disabled="false"] span:contains("Replace")')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Replace")'),
Mouse.cClick
]),
Chain.fromChains([
UiFinder.cFindIn('button.mce-close'),
Mouse.cClick
])
])
]),
sUndo(editor),
tinyApis.sAssertContent('<p>cats cats cats</p>'),
sRedo(editor),
tinyApis.sAssertContentPresence({ 'span.mce-match-marker': 0 }),
tinyApis.sAssertContent('<p>dogs cats cats</p>')
]))
], onSuccess, onFailure);
}, {
plugins: 'searchreplace',
toolbar: 'searchreplace',
skin_url: '/project/js/tinymce/skins/lightgray'
}, success, failure);
});