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


TypeScript Theme.default函数代码示例

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


在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

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

  InliteTheme();
  LinkPlugin();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyActions = TinyActions(editor);
    Pipeline.async({}, [
      tinyApis.sFocus,
      tinyApis.sSetContent('<p style="height: 5000px">a</p><p>b</p>'),
      tinyApis.sSetSelection([1], 0, [1], 1),
      tinyActions.sContentKeystroke(Keys.space(), {}),
      Chain.asStep({}, [
        Toolbar.cWaitForToolbar,
        Toolbar.cClickButton('Insert/Edit link')
      ]),
      tinyActions.sUiKeydown(Keys.enter(), {}),
      Step.sync(function () {
        const offset = window.pageYOffset;

        RawAssertions.assertEq('Should not be at top', offset > 0, true);
      })
    ], onSuccess, onFailure);
  }, {
    theme: 'inlite',
    plugins: 'link',
    insert_toolbar: 'quickimage media quicktable',
    selection_toolbar: 'bold italic | quicklink h1 h2 blockquote',
    inline: true,
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:35,代码来源:ClosedDialogScrollTest.ts

示例2: function

UnitTest.asynctest('browser.tinymce.themes.inlite.SkinFalseTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  InliteTheme();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    // This is a weird test that only checks that the skinloaded event is fired even if skin is set to false
    Pipeline.async({}, [
    ], onSuccess, onFailure);
  }, {
    skin: false,
    inline: true,
    theme: 'inlite',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:17,代码来源:SkinFalseTest.ts

示例3: function

UnitTest.asynctest('browser.alien.UnlinkTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  Theme();

  const sUnlinkSelection = function (editor) {
    return Step.sync(function () {
      Unlink.unlinkSelection(editor);
    });
  };

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

    const sAssertUnlink = function (inputHtml, startPath, startOffset, finishPath, finishOffset, expectedHtml) {
      return GeneralSteps.sequence([
        tinyApis.sSetContent(inputHtml),
        tinyApis.sSetSelection(startPath, startOffset, finishPath, finishOffset),
        sUnlinkSelection(editor),
        tinyApis.sAssertContent(expectedHtml, 'Should match expected anchor less html')
      ]);
    };

    Pipeline.async({}, [
      sAssertUnlink('<p><a href="#">a</a></p>', [0, 0, 0], 0, [0, 0, 0], 1, '<p>a</p>'),
      sAssertUnlink('<p><a href="#">a</a>b</p>', [0, 0, 0], 0, [0, 1], 1, '<p>ab</p>'),
      sAssertUnlink('<p><a href="#">a</a><p><a href="#">b</a>', [0, 0, 0], 0, [0, 0, 0], 1, '<p>a</p>\n<p><a href="#">b</a></p>'),
      sAssertUnlink('<p><a href="#">a</a><p><a href="#">b</a>', [0, 0, 0], 0, [1, 0, 0], 1, '<p>a</p>\n<p>b</p>')
    ], onSuccess, onFailure);
  }, {
    inline: true,
    theme: 'inlite',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:36,代码来源:UnlinkTest.ts

示例4: function

UnitTest.asynctest('browser/core/ActionsTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  Theme();

  const wrap = function (f, args) {
    return function () {
      const currentArgs = Array.prototype.slice.call(arguments);
      return Step.sync(function () {
        f.apply(null, [].concat(args).concat(currentArgs));
      });
    };
  };

  const sInsertTableTests = function (editor, tinyApis) {
    const sInsertTableTest = function (cols, rows, expectedHtml, message) {
      const sInsertTable: any = wrap(Actions.insertTable, editor);

      return GeneralSteps.sequence([
        tinyApis.sSetContent(''),
        sInsertTable(cols, rows),
        tinyApis.sAssertContent(expectedHtml, message)
      ]);
    };

    return GeneralSteps.sequence([
      sInsertTableTest(2, 3, [
        '<table style="width: 100%;">',
        '<tbody>',
        '<tr>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '</tr>',
        '<tr>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '</tr>',
        '<tr>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '</tr>',
        '</tbody>',
        '</table>'
      ].join('\n'),
        'Should be a 2x3 table'
      ),

      sInsertTableTest(3, 2, [
        '<table style="width: 100%;">',
        '<tbody>',
        '<tr>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '</tr>',
        '<tr>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '<td>&nbsp;</td>',
        '</tr>',
        '</tbody>',
        '</table>'
      ].join('\n'),
        'Should be a 3x2 table'
      )
    ]);
  };

  const sFormatBlockTests = function (editor, tinyApis) {
    const sFormatBlockTest = function (name) {
      const sFormatBlock: any = wrap(Actions.formatBlock, editor);

      return GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p>'),
        tinyApis.sSetCursor([0], 0),
        sFormatBlock(name),
        tinyApis.sAssertContent('<' + name + '>a</' + name + '>', 'Should be a ' + name + ' block')
      ]);
    };

    return GeneralSteps.sequence([
      sFormatBlockTest('h1'),
      sFormatBlockTest('h2'),
      sFormatBlockTest('pre')
    ]);
  };

  const sCreateLinkTests = function (editor, tinyApis) {
    const sCreateLinkTest = function (inputHtml, url, sPath, sOffset, fPath, fOffset, expectedHtml) {
      const sCreateLink: any = wrap(Actions.createLink, editor);

      return GeneralSteps.sequence([
        tinyApis.sSetContent(inputHtml),
        tinyApis.sSetSelection(sPath, sOffset, fPath, fOffset),
        sCreateLink(url),
        tinyApis.sAssertContent(expectedHtml, 'Should have a link')
      ]);
    };

//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:ActionsTest.ts

示例5: function

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

  ImagePlugin();
  LinkPlugin();
  PastePlugin();
  ContextMenuPlugin();
  TablePlugin();
  TextpatternPlugin();
  Theme();

  const cKeyStroke = function (keyvalue, modifiers) {
    return Chain.op(function (dispatcher) {
      Keyboard.keystroke(keyvalue, modifiers, dispatcher);
    });
  };

  const sSetupLinkableContent = function (tinyApis) {
    return GeneralSteps.sequence([
      tinyApis.sSetContent(
        '<h1 id="a">abc</h1>' +
        '<h2 id="b">abcd</h2>' +
        '<h3 id="c">abce</h3>'
      ),
      tinyApis.sSetSelection([0, 0], 0, [0, 0], 1)
    ]);
  };

  const sSelectAutoCompleteLink = function (tinyApis, url) {
    return Chain.asStep({}, [
      Chain.fromParent(Toolbar.cWaitForToolbar, [
        Toolbar.cClickButton('Insert/Edit link')
      ]),
      Chain.fromParent(UiFinder.cFindIn('input'), [
        UiControls.cSetValue(url),
        cKeyStroke(Keys.space(), {}),
        cKeyStroke(Keys.down(), {})
      ]),
      Chain.inject(TinyDom.fromDom(document)),
      Chain.fromParent(FocusTools.cGetFocused, [
        cKeyStroke(Keys.down(), {}),
        cKeyStroke(Keys.enter(), {})
      ]),
      Chain.fromParent(Toolbar.cWaitForToolbar, [
        Toolbar.cClickButton('Ok')
      ])
    ]);
  };

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

    Pipeline.async({}, [
      tinyApis.sFocus,
      sSetupLinkableContent(tinyApis),
      tinyActions.sContentKeystroke(Keys.space(), {}),
      sSelectAutoCompleteLink(tinyApis, 'a'),
      tinyApis.sAssertContent(
        '<h1 id="a"><a href="#b">a</a>bc</h1>\n' +
        '<h2 id="b">abcd</h2>\n' +
        '<h3 id="c">abce</h3>'
      )
    ], onSuccess, onFailure);
  }, {
    theme: 'inlite',
    plugins: 'image table link paste contextmenu textpattern',
    insert_toolbar: 'quickimage media quicktable',
    selection_toolbar: 'bold italic | quicklink h1 h2 blockquote',
    inline: true,
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:74,代码来源:AutoCompleteTest.ts

示例6: sContentActionTest

UnitTest.asynctest('browser.core.ThemeTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const dialogRoot = TinyDom.fromDom(document.body);

  InliteTheme();
  ImagePlugin();
  TablePlugin();
  LinkPlugin();
  PastePlugin();
  ContextMenuPlugin();
  TextPatternPlugin();

  const sClickFocusedButton = function (selector) {
    return GeneralSteps.sequence([
      Waiter.sTryUntil(
        'Focus was not moved to the expected element',
        FocusTools.sIsOnSelector('Is not on the right element', TinyDom.fromDom(document), selector),
        10,
        1000
      ),
      Chain.asStep(TinyDom.fromDom(document), [
        FocusTools.cGetFocused,
        Mouse.cTrueClick
      ])
    ]);
  };

  const sBoldTests = function (tinyApis) {
    return GeneralSteps.sequence([
      tinyApis.sSetContent('<p>a</p>'),
      tinyApis.sSetSelection([0, 0], 0, [0, 0], 1),
      Toolbar.sClickButton('Bold'),
      tinyApis.sAssertContent('<p><strong>a</strong></p>')
    ]);
  };

  const sH2Tests = function (tinyApis) {
    return GeneralSteps.sequence([
      tinyApis.sSetContent('<p>a</p>'),
      tinyApis.sSetSelection([0, 0], 0, [0, 0], 1),
      Toolbar.sClickButton('Heading 2'),
      tinyApis.sAssertContent('<h2>a</h2>')
    ]);
  };

  const sInsertLink = function (url) {
    return Chain.asStep({}, [
      Toolbar.cWaitForToolbar,
      Toolbar.cClickButton('Insert/Edit link'),
      Toolbar.cWaitForToolbar,
      UiFinder.cFindIn('input'),
      UiControls.cSetValue(url),
      Toolbar.cWaitForToolbar,
      Toolbar.cClickButton('Ok')
    ]);
  };

  const cWaitForConfirmDialog = Chain.fromChainsWith(dialogRoot, [
    UiFinder.cWaitForState('window element', '.mce-window', function () {
      return true;
    })
  ]);

  const cClickButton = function (btnText) {
    return Chain.fromChains([
      UiFinder.cFindIn('button:contains("' + btnText + '")'),
      Mouse.cTrueClick
    ]);
  };

  const sClickConfirmButton = function (btnText) {
    return Chain.asStep({}, [
      cWaitForConfirmDialog,
      cClickButton(btnText)
    ]);
  };

  const sInsertLinkConfirmPrefix = function (url, btnText) {
    return GeneralSteps.sequence([
      sInsertLink(url),
      sClickConfirmButton(btnText)
    ]);
  };

  const sUnlink = Chain.asStep({}, [
    Toolbar.cWaitForToolbar,
    Toolbar.cClickButton('Insert/Edit link'),
    Toolbar.cWaitForToolbar,
    Toolbar.cClickButton('Remove link')
  ]);

  const sLinkTests = function (tinyApis, tinyActions) {
    const sContentActionTest = function (inputHtml, spath, soffset, fpath, foffset, expectedHtml, sAction) {
      return GeneralSteps.sequence([
        tinyApis.sSetContent(inputHtml),
        tinyApis.sSetSelection(spath, soffset, fpath, foffset),
        tinyActions.sContentKeystroke(Keys.space(), {}),
        sAction,
        tinyApis.sAssertContent(expectedHtml)
//.........这里部分代码省略.........
开发者ID:abstask,项目名称:tinymce,代码行数:101,代码来源:ThemeTest.ts

示例7: function

UnitTest.asynctest('browser.core.ElementMatcherTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  Theme();

  const eq = (target) => (elm) => elm === target;

  const constantFalse = function (/*elm*/) {
    return false;
  };

  const sElementTest = function (tinyApis, editor, inputHtml, selector) {
    return Step.sync(function () {
      let target, result;

      editor.setContent(inputHtml);
      target = editor.dom.select(selector)[0];

      result = ElementMatcher.element(target, [
        PredicateId.create('a', constantFalse),
        PredicateId.create('b', eq(target)),
      ])(editor);

      Assertions.assertEq('Should be matching B', 'b', result.id);
      Assertions.assertEq('Should be have width', true, result.rect.w > 0);
    });
  };

  const sParentTest = function (tinyApis, editor, inputHtml, selector) {
    return Step.sync(function () {
      let target, parents, result;

      editor.setContent(inputHtml);
      target = editor.dom.select(selector)[0];
      parents = editor.dom.getParents(target);

      result = ElementMatcher.parent(parents, [
        PredicateId.create('a', constantFalse),
        PredicateId.create('b', eq(parents[1])),
        PredicateId.create('c', eq(parents[0])),
      ])(editor);

      Assertions.assertEq('Should be matching C the closest one', 'c', result.id);
      Assertions.assertEq('Should be have width', true, result.rect.w > 0);
    });
  };

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

    Pipeline.async({}, [
      sElementTest(tinyApis, editor, '<p>a</p>', 'p'),
      sParentTest(tinyApis, editor, '<div><p><em>a</em></p></div>', 'em'),
    ], onSuccess, onFailure);
  }, {
    inline: true,
    theme: 'inlite',
    skin_url: '/project/js/tinymce/skins/lightgray',
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:61,代码来源:ElementMatcherTest.ts

示例8: containsXY

UnitTest.asynctest('browser/core/MeasureTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  InliteTheme();

  const containsXY = function (r, x, y, loose) {
    const x1 = r.x - loose;
    const y1 = r.y - loose;
    const x2 = r.x + r.w + loose * 2;
    const y2 = r.y + r.h + loose * 2;

    return x >= x1 && x <= x2 && y >= y1 && y <= y2;
  };

  const contains = function (a, b, loose) {
    return containsXY(a, b.x, b.y, loose) && containsXY(a, b.x + b.w, b.y + b.h, loose);
  };

  const sAssertRect = function (editor, measure) {
    return Step.sync(function () {
      const elementRect = measure();
      const pageAreaRect = Measure.getPageAreaRect(editor);
      const contentAreaRect = Measure.getContentAreaRect(editor);

      Assertions.assertEq('Rect is not in page area rect', contains(pageAreaRect, elementRect, 1), true);
      Assertions.assertEq('Rect is not in content area rect', contains(contentAreaRect, elementRect, 1), true);
      Assertions.assertEq('Rect should have width', elementRect.w > 0, true);
      Assertions.assertEq('Rect should have height', elementRect.h > 0, true);
    });
  };

  const getElementRectFromSelector = function (editor, selector) {
    return function () {
      const elm = editor.dom.select(selector)[0];
      const rect = Measure.getElementRect(editor, elm);
      return rect;
    };
  };

  const getSelectionRectFromSelector = function (editor) {
    return function () {
      const rect = Measure.getSelectionRect(editor);
      return rect;
    };
  };

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

    Pipeline.async({}, [
      tinyApis.sSetContent('<p>a</p><p>b</p><div style="width: 50px; height: 300px">c</div><p>d</p>'),
      sAssertRect(editor, getElementRectFromSelector(editor, 'p:nth-child(1)')),
      tinyApis.sSetCursor([1, 0], 0),
      sAssertRect(editor, getSelectionRectFromSelector(editor))
    ], onSuccess, onFailure);
  }, {
    inline: true,
    theme: 'inlite',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:62,代码来源:MeasureTest.ts

示例9: function

UnitTest.asynctest('browser.core.SelectionMatcherTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  InliteTheme();

  const assertResult = function (expectedResultState, result) {
    Assertions.assertEq('Should not be null', result !== null, expectedResultState);

    if (expectedResultState === true) {
      Assertions.assertEq('Should be matching a', result.id, 'a');
      Assertions.assertEq('Should be have width', result.rect.w > 0, true);
    }
  };

  const sTextSelectionTest = function (tinyApis, editor, inputHtml, spath, soffset, fpath, foffset, expectedResultState) {
    const sAssertTextSelectionResult = Step.sync(function () {
      const result = SelectionMatcher.textSelection('a')(editor);
      assertResult(expectedResultState, result);
    });

    return GeneralSteps.sequence([
      tinyApis.sSetContent(inputHtml),
      tinyApis.sSetSelection(spath, soffset, fpath, foffset),
      sAssertTextSelectionResult
    ]);
  };

  const sTextSelectionTests = function (tinyApis, editor) {
    return GeneralSteps.sequence([
      sTextSelectionTest(tinyApis, editor, '<p>a<.p>', [0], 0, [0], 1, true),
      sTextSelectionTest(tinyApis, editor, '<p>a</p>', [0], 0, [0], 0, false)
    ]);
  };

  const sEmptyTextBlockTest = function (tinyApis, editor, inputHtml, spath, soffset, fpath, foffset, expectedResultState) {
    const sAssertTextSelectionResult = Step.sync(function () {
      const elements = editor.dom.getParents(editor.selection.getStart());
      const result = SelectionMatcher.emptyTextBlock(elements, 'a')(editor);
      assertResult(expectedResultState, result);
    });

    return GeneralSteps.sequence([
      tinyApis.sSetContent(inputHtml),
      tinyApis.sSetSelection(spath, soffset, fpath, foffset),
      sAssertTextSelectionResult
    ]);
  };

  const sEmptyTextBlockTests = function (tinyApis, editor) {
    return GeneralSteps.sequence([
      sEmptyTextBlockTest(tinyApis, editor, '<p>a</p>', [0], 0, [0], 0, false),
      sEmptyTextBlockTest(tinyApis, editor, '<p>a</p>', [0], 0, [0], 1, false),
      sEmptyTextBlockTest(tinyApis, editor, '<p><br></p>', [0], 0, [0], 0, true),
      sEmptyTextBlockTest(tinyApis, editor, '<p><em><br></em></p>', [0, 0], 0, [0, 0], 0, true)
    ]);
  };

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

    Pipeline.async({}, [
      tinyApis.sFocus,
      sTextSelectionTests(tinyApis, editor),
      sEmptyTextBlockTests(tinyApis, editor)
    ], onSuccess, onFailure);
  }, {
    inline: true,
    theme: 'inlite',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:72,代码来源:SelectionMatcherTest.ts

示例10: success

import ImagePlugin from 'tinymce/plugins/image/Plugin';
import LinkPlugin from 'tinymce/plugins/link/Plugin';
import PastePlugin from 'tinymce/plugins/paste/Plugin';
import TablePlugin from 'tinymce/plugins/table/Plugin';
import TextPatternPlugin from 'tinymce/plugins/textpattern/Plugin';
import InliteTheme from 'tinymce/themes/inlite/Theme';

AnchorPlugin();
AutoLinkPlugin();
ContextMenuPlugin();
ImagePlugin();
LinkPlugin();
PastePlugin();
TablePlugin();
TextPatternPlugin();
InliteTheme();

EditorManager.init({
  selector: 'div.tinymce',
  theme: 'inlite',
  plugins: 'image table link anchor paste contextmenu textpattern autolink',
  skin_url: '../../../../../js/tinymce/skins/lightgray',
  insert_toolbar: 'quickimage quicktable',
  selection_toolbar: 'bold italic | quicklink h2 h3 blockquote',
  inline: true,
  paste_data_images: true,
  filepicker_validator_handler (query, success) {
    const valid = /^https?:/.test(query.url);

    success({
      status: valid ? 'valid' : 'invalid',
开发者ID:howardjing,项目名称:tinymce,代码行数:31,代码来源:Demos.ts


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