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


TypeScript Attr.get方法代码示例

本文整理汇总了TypeScript中@ephox/sugar.Attr.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Attr.get方法的具体用法?TypeScript Attr.get怎么用?TypeScript Attr.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/sugar.Attr的用法示例。


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

示例1: function

const fromLink = function (link) {
  const text = TextContent.get(link);
  const url = Attr.get(link, 'href');
  const title = Attr.get(link, 'title');
  const target = Attr.get(link, 'target');
  return {
    url: defaultToEmpty(url),
    text: text !== url ? defaultToEmpty(text) : '',
    title: defaultToEmpty(title),
    target: defaultToEmpty(target),
    link: Option.some(link)
  };
};
开发者ID:abstask,项目名称:tinymce,代码行数:13,代码来源:LinkBridge.ts

示例2:

        Logger.t('Check if iframe has the right custom attributes', Step.sync(function () {
          const ifr = Element.fromDom(editor.iframeElement);

          Assertions.assertEq('Id should not be the defined x', true, Attr.get(ifr, 'id') !== 'x');
          Assertions.assertEq('Custom attribute whould have the right value', 'a', Attr.get(ifr, 'data-custom1'));
          Assertions.assertEq('Custom attribute whould have the right value', 'b', Attr.get(ifr, 'data-custom2'));
        }))
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:7,代码来源:InitIframeEditorWithCustomAttrsTest.ts

示例3:

 const getAttr = (c, property: string): Option<any> => {
   if (Attr.has(c, property)) {
     return Option.some(Attr.get(c, property));
   } else {
     return Option.none();
   }
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:Identification.ts

示例4: function

const takeoverViewport = function (toolbarHeight, height, viewport) {
  const oldViewportStyle = Attr.get(viewport, 'style');

  Scrollable.register(viewport);
  Css.setAll(viewport, {
    position: 'absolute',
    // I think there a class that does this overflow scrolling touch part
    height: height + 'px',
    width: '100%',
    top: toolbarHeight + 'px'
  });

  Attr.set(viewport, yFixedData, toolbarHeight + 'px');
  Attr.set(viewport, yScrollingData, 'true');
  Attr.set(viewport, yFixedProperty, 'top');

  const restore = function () {
    Scrollable.deregister(viewport);
    Attr.set(viewport, 'style', oldViewportStyle || '');
    Attr.remove(viewport, yFixedData);
    Attr.remove(viewport, yScrollingData);
    Attr.remove(viewport, yFixedProperty);
  };

  return {
    restore
  };
};
开发者ID:abstask,项目名称:tinymce,代码行数:28,代码来源:IosViewport.ts

示例5:

 Step.sync(function () {
   const component = memento.get(realm.socket());
   Assertions.assertEq(
     'Selected/Pressed state of component: (' + Attr.get(component.element(), 'class') + ')',
     state,
     Toggling.isOn(component)
   );
 }),
开发者ID:abstask,项目名称:tinymce,代码行数:8,代码来源:TestUi.ts

示例6:

 const cGetDialogLabelId = Chain.binder((dialogE: Element) => {
   if (Attr.has(dialogE, 'aria-labelledby')) {
     const labelId = Attr.get(dialogE, 'aria-labelledby');
     return labelId.length > 0 ? Result.value(labelId) : Result.error('Dialog has zero length aria-labelledby attribute');
   } else {
     return Result.error('Dialog has no aria-labelledby attribute');
   }
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:SilverDialogAriaLabelTest.ts

示例7: function

 Arr.each(clobberedEls, function (element) {
   const restore = Attr.get(element, attr);
   if (restore !== 'no-styles') {
     Attr.set(element, 'style', restore);
   } else {
     Attr.remove(element, 'style');
   }
   Attr.remove(element, attr);
 });
开发者ID:abstask,项目名称:tinymce,代码行数:9,代码来源:Thor.ts

示例8: Error

 Chain.op((dialog) => {
   if (Attr.has(dialog, 'aria-labelledby')) {
     const labelledby = Attr.get(dialog, 'aria-labelledby');
     const dialogLabel = SelectorFind.descendant(dialog, '#' + labelledby).getOrDie('Could not find labelledby');
     Assertions.assertEq('Checking label text', ariaLabel, Html.get(dialogLabel));
   } else {
     throw new Error('Dialog did not have an aria-labelledby');
   }
 })
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:FullScreenPluginTest.ts

示例9:

    (editor: Editor, onSuccess, onFailure) => {
      const replacedElem = Element.fromDom(editor.getElement());

      Pipeline.async({ }, [
        Chain.asStep(Body.body(), [
          UiFinder.cFindIn(`#${Attr.get(replacedElem, 'id')}`),
          Chain.binder((elem) => Traverse.nextSibling(elem).fold(() => Result.error('Replaced element has no next sibling'), Result.value)),
          Chain.mapper((elem) => Class.has(elem, 'tox-tinymce')),
          Assertions.cAssertEq('Replaced element\'s next sibling has "tox-tinymce" class', true)
        ])
      ], onSuccess, onFailure);
    },
开发者ID:tinymce,项目名称:tinymce,代码行数:12,代码来源:ToxWrappingTest.ts


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