• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript mcagar.LegacyUnit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@ephox/mcagar.LegacyUnit的典型用法代码示例。如果您正苦于以下问题:TypeScript LegacyUnit类的具体用法?TypeScript LegacyUnit怎么用?TypeScript LegacyUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: function

  suite.test('isAtStart/isAtEnd/isTextPosition', function () {
    setupHtml('<b>abc</b><p><input></p>');

    LegacyUnit.equal(CaretPosition.isAtStart(CaretPosition(getRoot().firstChild.firstChild, 0)), true);
    LegacyUnit.equal(CaretPosition.isAtStart(CaretPosition(getRoot().firstChild.firstChild, 1)), false);
    LegacyUnit.equal(CaretPosition.isAtStart(CaretPosition(getRoot().firstChild.firstChild, 3)), false);
    LegacyUnit.equal(CaretPosition.isAtStart(CaretPosition(getRoot().lastChild, 0)), true);
    LegacyUnit.equal(CaretPosition.isAtStart(CaretPosition(getRoot().lastChild, 1)), false);
    LegacyUnit.equal(CaretPosition.isAtEnd(CaretPosition(getRoot().firstChild.firstChild, 3)), true);
    LegacyUnit.equal(CaretPosition.isAtEnd(CaretPosition(getRoot().firstChild.firstChild, 1)), false);
    LegacyUnit.equal(CaretPosition.isAtEnd(CaretPosition(getRoot().firstChild.firstChild, 0)), false);
    LegacyUnit.equal(CaretPosition.isAtEnd(CaretPosition(getRoot().lastChild, 1)), true);
    LegacyUnit.equal(CaretPosition.isAtEnd(CaretPosition(getRoot().lastChild, 0)), false);
    LegacyUnit.equal(CaretPosition.isTextPosition(CaretPosition(getRoot().firstChild.firstChild, 0)), true);
    LegacyUnit.equal(CaretPosition.isTextPosition(CaretPosition(getRoot().lastChild, 0)), false);
  });
开发者ID:abstask,项目名称:tinymce,代码行数:16,代码来源:CaretPositionTest.ts


示例2: function

 suite.test('startsWithCaretContainer', function () {
   setupHtml(Zwsp.ZWSP + 'abc');
   LegacyUnit.equal(CaretContainer.startsWithCaretContainer(getRoot().firstChild), true);
 });
开发者ID:mdgbayly,项目名称:tinymce,代码行数:4,代码来源:CaretContainerTest.ts


示例3: commands

  suite.test('Formatting commands (xhtmlTextStyles)', function (editor) {
    editor.focus();
    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('Bold');
    LegacyUnit.equal(editor.getContent(), '<p><strong>test 123</strong></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('Italic');
    LegacyUnit.equal(editor.getContent(), '<p><em>test 123</em></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('Underline');
    LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('Strikethrough');
    LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('FontName', false, 'Arial');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('FontSize', false, '7');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: xx-large;">test 123</span></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('ForeColor', false, '#FF0000');
    LegacyUnit.equal(editor.getContent(), '<p><span style="color: #ff0000;">test 123</span></p>');

    editor.setContent('test 123');
    editor.execCommand('SelectAll');
    editor.execCommand('HiliteColor', false, '#FF0000');
    LegacyUnit.equal(editor.getContent(), '<p><span style="background-color: #ff0000;">test 123</span></p>');

    editor.setContent('<p><span style="text-decoration: underline;">test 123</span></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');

    editor.setContent('<p><span style="text-decoration: line-through;">test 123</span></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');

    editor.setContent('<p><span style="font-family: Arial;">test 123</span></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');

    editor.setContent('<p><span style="font-size: xx-large;">test 123</span></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: xx-large;">test 123</span></p>');

    editor.setContent('<p><strike>test 123</strike></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');

    editor.setContent('<p><font face="Arial">test 123</font></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');

    editor.setContent('<p><font size="7">test 123</font></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: 300%;">test 123</span></p>');

    editor.setContent('<p><font face="Arial" size="7">test 123</font></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="font-size: 300%; font-family: Arial;">test 123</span></p>');

    editor.setContent('<font style="background-color: #ff0000" color="#ff0000">test</font><font face="Arial">test</font>');
    LegacyUnit.equal(
      editor.getContent(),
      '<p><span style="color: #ff0000; background-color: #ff0000;">test</span><span style="font-family: Arial;">test</span></p>'
    );

    editor.setContent('<p><font face="Arial" style="color: #ff0000">test 123</font></p>');
    LegacyUnit.equal(editor.getContent(), '<p><span style="color: #ff0000; font-family: Arial;">test 123</span></p>');
  });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:75,代码来源:FormattingCommandsTest.ts


示例4: function

 suite.test('unlink - unselected a[href] with childNodes', function (editor) {
   editor.setContent('<p><a href="test"><strong><em>test</em></strong></a></p>');
   LegacyUnit.setSelection(editor, 'em', 0);
   editor.execCommand('unlink');
   LegacyUnit.equal(editor.getContent(), '<p><strong><em>test</em></strong></p>');
 });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:6,代码来源:FormattingCommandsTest.ts


示例5: function

 suite.test('collapse', function () {
   LegacyUnit.deepEqual(ClientRect.collapse(rect(10, 20, 30, 40), true), rect(10, 20, 0, 40));
   LegacyUnit.deepEqual(ClientRect.collapse(rect(10, 20, 30, 40), false), rect(40, 20, 0, 40));
 });
开发者ID:abstask,项目名称:tinymce,代码行数:4,代码来源:ClientRectTest.ts


示例6: function

UnitTest.asynctest('tinymce.lists.browser.RemoveTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const suite = LegacyUnit.createSuite();

  Plugin();
  Theme();

  suite.test('Remove UL at single LI', function (editor) {
    editor.getBody().innerHTML = LegacyUnit.trimBrs(
      '<ul>' +
      '<li>a</li>' +
      '</ul>'
    );

    editor.focus();
    LegacyUnit.setSelection(editor, 'li');
    LegacyUnit.execCommand(editor, 'InsertUnorderedList');

    LegacyUnit.equal(editor.getContent(),
      '<p>a</p>'
    );
    LegacyUnit.equal(editor.selection.getStart().nodeName, 'P');
  });

  suite.test('Remove UL at start LI', function (editor) {
    editor.getBody().innerHTML = LegacyUnit.trimBrs(
      '<ul>' +
      '<li>a</li>' +
      '<li>b</li>' +
      '<li>c</li>' +
      '</ul>'
    );

    editor.focus();
    LegacyUnit.setSelection(editor, 'li');
    LegacyUnit.execCommand(editor, 'InsertUnorderedList');

    LegacyUnit.equal(editor.getContent(),
      '<p>a</p>' +
      '<ul>' +
      '<li>b</li>' +
      '<li>c</li>' +
      '</ul>'
    );
    LegacyUnit.equal(editor.selection.getStart().nodeName, 'P');
  });

  suite.test('Remove UL at start empty LI', function (editor) {
    editor.getBody().innerHTML = LegacyUnit.trimBrs(
      '<ul>' +
      '<li><br></li>' +
      '<li>b</li>' +
      '<li>c</li>' +
      '</ul>'
    );

    editor.focus();
    LegacyUnit.setSelection(editor, 'li');
    LegacyUnit.execCommand(editor, 'InsertUnorderedList');

    LegacyUnit.equal(editor.getContent(),
      '<p>\u00a0</p>' +
      '<ul>' +
      '<li>b</li>' +
      '<li>c</li>' +
      '</ul>'
    );
    LegacyUnit.equal(editor.selection.getNode().nodeName, 'P');
  });

  suite.test('Remove UL at middle LI', function (editor) {
    editor.getBody().innerHTML = LegacyUnit.trimBrs(
      '<ul>' +
      '<li>a</li>' +
      '<li>b</li>' +
      '<li>c</li>' +
      '</ul>'
    );

    editor.focus();
    LegacyUnit.setSelection(editor, 'li:nth-child(2)', 1);
    LegacyUnit.execCommand(editor, 'InsertUnorderedList');

    LegacyUnit.equal(editor.getContent(),
      '<ul>' +
      '<li>a</li>' +
      '</ul>' +
      '<p>b</p>' +
      '<ul>' +
      '<li>c</li>' +
      '</ul>'
    );
    LegacyUnit.equal(editor.selection.getStart().nodeName, 'P');
  });

  suite.test('Remove UL at middle empty LI', function (editor) {
    editor.getBody().innerHTML = LegacyUnit.trimBrs(
      '<ul>' +
      '<li>a</li>' +
//.........这里部分代码省略.........
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:101,代码来源:RemoveTest.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript mcagar.TinyDom类代码示例发布时间:2022-05-28
下一篇:
TypeScript mcagar.Editor类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap