本文整理汇总了TypeScript中@ephox/mcagar.TinyApis函数的典型用法代码示例。如果您正苦于以下问题:TypeScript TinyApis函数的具体用法?TypeScript TinyApis怎么用?TypeScript TinyApis使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TinyApis函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Logger.t('Should should retain open attribute if it is not opened', GeneralSteps.sequence([
tinyApis.sSetContent('<details><summary>a</summary>b</details>'),
tinyApis.sAssertContentStructure(ApproxStructure.build((s, str, arr) => {
return s.element('body', {
children: [
s.element('details', {
attrs: {
'open': str.is('open'),
'data-mce-open': str.none('Should not have a data attr')
},
children: [
s.element('summary', {
children: [
s.text(str.is('a'))
]
}),
s.text(str.is('b'))
]
})
]
});
})),
tinyApis.sAssertContent('<details><summary>a</summary>b</details>')
])),
Logger.t('Should should retain open attribute if it opened', GeneralSteps.sequence([
tinyApis.sSetContent('<details open="open"><summary>a</summary>b</details>'),
tinyApis.sAssertContentStructure(ApproxStructure.build((s, str, arr) => {
return s.element('body', {
children: [
s.element('details', {
attrs: {
'open': str.is('open'),
'data-mce-open': str.is('open')
},
children: [
s.element('summary', {
children: [
s.text(str.is('a'))
]
}),
s.text(str.is('b'))
]
})
]
});
})),
tinyApis.sAssertContent('<details open="open"><summary>a</summary>b</details>')
]))
], onSuccess, onFailure);
}, {
示例2: TinyApis
TinyLoader.setup((editor: Editor, onSuccess, onFailure) => {
const uiContainer = Element.fromDom(editor.getContainer());
const contentAreaContainer = Element.fromDom(editor.getContentAreaContainer());
const tinyApis = TinyApis(editor);
Pipeline.async({ }, Arr.flatten([
sUiContainerTest(editor, uiContainer, tinyApis),
sContentAreaContainerTest(contentAreaContainer)
]), onSuccess, onFailure);
},
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
sTestEnterAtStartOfAnchorZwsp(tinyApis, tinyActions),
sTestEnterAtEndOfAnchorZwsp(tinyApis, tinyActions),
sTestEnterAtStartOfAnchorZwspWithAdjacentContent(tinyApis, tinyActions),
sTestEnterAtEndOfAnchorZwspWithAdjacentContent(tinyApis, tinyActions)
], onSuccess, onFailure);
}, {
示例4: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Logger.t('Select image by context menu clicking on it', GeneralSteps.sequence([
Step.label('Focus editor', tinyApis.sFocus),
Step.label('Set editor content to a paragraph with a image within', tinyApis.sSetContent('<p><img src="http://www.google.com/google.jpg" width="100" height="100"></p>')),
Step.label('Context menu click on the image', sContextMenuClickInMiddleOf(editor, [0, 0])),
Step.label('Check that the image is selected', tinyApis.sAssertSelection([0], 0, [0], 1))
]))
], onSuccess, onFailure);
}, {
示例5: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor), tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
sBoldTests(tinyApis),
sH2Tests(tinyApis),
sLinkTests(tinyApis, tinyActions),
sInsertTableTests(editor, tinyApis),
sAriaTests(tinyApis, tinyActions)
], onSuccess, onFailure);
}, {
示例6: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Logger.t('Select image by context menu clicking on it', GeneralSteps.sequence([
tinyApis.sFocus,
tinyApis.sSetContent('<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==" width="100" height="100"></p>'),
sContextMenuClickInMiddleOf(editor, [0, 0]),
tinyApis.sAssertSelection([0], 0, [0], 1)
]))
], onSuccess, onFailure);
}, {
示例7: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'Table: test that settings for appearance can be disabled', [
tinyApis.sFocus,
tinyApis.sSetContent(tableHtml),
// This used to be opening the context toolbar.
tinyApis.sSelect('table td', [0]),
tinyApis.sExecCommand('mceTableProps'),
Chain.asStep({}, [
TableTestUtils.cWaitForDialog,
Chain.op(function (dialog) {
Assertions.assertPresence(
'assert presence of spacing, padding, border and caption inputs',
{
// Remove the label:0 when it is working.
'label:contains("Cell spacing")': 0,
'label:contains("Cell padding")': 0,
'label:contains("Border") + input': 0,
'label:contains("Caption")': 0
}, dialog);
})
]),
TableTestUtils.sClickDialogButton('close', false)
]),
Log.stepsAsStep('TBA', 'Table: test that settings for appearance can be enabled', [
tinyApis.sSetSetting('table_appearance_options', true),
tinyApis.sFocus,
tinyApis.sSetContent(tableHtml),
// This used to be opening the context toolbar.
tinyApis.sSelect('table td', [0]),
tinyApis.sExecCommand('mceTableProps'),
Chain.asStep({}, [
TableTestUtils.cWaitForDialog,
Chain.op(function (dialog) {
Assertions.assertPresence(
'assert presence of spacing, padding, border and caption inputs',
{
// Remove the label:0 when it is working.
'label:contains("Cell spacing")': 1,
'label:contains("Cell padding")': 1,
'label:contains("Border") + input': 1,
'label:contains("Caption")': 1
}, dialog);
})
]),
TableTestUtils.sClickDialogButton('close', false)
])
], onSuccess, onFailure);
}, {
示例8: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Logger.t('get text format content should trim zwsp', GeneralSteps.sequence([
tinyApis.sSetContent('<p>' + Zwsp.ZWSP + 'a</p>'),
Step.sync(function () {
const html = editor.getContent({ format: 'text' });
Assertions.assertEq('Should be expected html', 'a', html);
})
]))
], onSuccess, onFailure);
}, {
示例9: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({},
Log.steps('TBA', 'Preview: Set content, set style setting and assert content and style. Delete style and assert style is removed', [
tinyApis.sSetContent('<p>hello world</p>'),
tinyApis.sSetSetting('content_style', 'p {color: blue;}'),
sAssertIframeHtmlContains(editor, '<style type="text/css">p {color: blue;}</style>'),
tinyApis.sDeleteSetting('content_style'),
sAssertIframeHtmlNotContains(editor, '<style type="text/css">p {color: blue;}</style>')
])
, onSuccess, onFailure);
}, {
示例10: TinyApis
TinyLoader.setup(function (editor: Editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, Env.gecko ? [ // This test is only relevant on Firefox
Logger.t('cursor before table type', GeneralSteps.sequence([
tinyApis.sSetContent('<table style="border-collapse: collapse; width: 100%;" border="1"><tbody><tr><td style="width: 50%;"> </td><td style="width: 50%;"> </td></tr><tr><td style="width: 50%;"> </td><td style="width: 50%;"> </td></tr></tbody></table>'),
tinyApis.sSetCursor([], 0),
sAssertUndoManagerDataLength(editor, 1),
Step.sync(() => KeyUtils.type(editor, 'a')),
sAssertUndoManagerDataLength(editor, 3)
]))
] : [], onSuccess, onFailure);
}, {