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


TypeScript Attr.set方法代码示例

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


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

示例1: 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

示例2: decorate

const makeAnnotation = (eDoc: Document, { uid = Id.generate('mce-annotation'), ...data }, annotationName: string, decorate: Decorator): Element => {
  const master = Element.fromTag('span', eDoc);
  Class.add(master, Markings.annotation());
  Attr.set(master, `${Markings.dataAnnotationId()}`, uid);
  Attr.set(master, `${Markings.dataAnnotation()}`, annotationName);

  const { attributes = { }, classes = [ ] } = decorate(uid, data);
  Attr.setAll(master, attributes);
  Classes.add(master, classes);
  return master;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:11,代码来源:Wrapping.ts

示例3: function

    return function (element) {
      const styles = Attr.get(element, 'style');
      const backup = styles === undefined ? 'no-styles' : styles.trim();

      if (backup === clobberStyle) {
        return;
      } else {
        Attr.set(element, attr, backup);
        Attr.set(element, 'style', clobberStyle);
      }
    };
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:Thor.ts

示例4: function

 const restore = function () {
   if (backup !== undefined && backup !== null && backup.length > 0) {
     Attr.set(element, 'content', backup);
   } else {
     // According to apple docs the default is:
     //  width=980
     //  height=<calculated>
     //  initial-scale=<calculated>
     //  minimum-scale=0.25
     //  maximum-scale=5.0
     //  user-scalable yes
     // However just setting user-scalable seems to fix pinch zoom and who knows these defaults might change
     Attr.set(element, 'content', 'user-scalable=yes');
   }
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:15,代码来源:MetaViewport.ts

示例5: loadImage

  const updateSrc = (anyInSystem: AlloyComponent, url: string): Promise<Option<Element>> => {
    const img = Element.fromTag('img');
    Attr.set(img, 'src', url);
    return loadImage(img.dom()).then(() => {
      return memContainer.getOpt(anyInSystem).map((panel) => {
        const aImg = GuiFactory.external({
          element: img
        });

        Replacing.replaceAt(panel, 1, Option.some(aImg));

        const lastViewRect = viewRectState.get();
        const viewRect = {
          x: 0,
          y: 0,
          w: img.dom().naturalWidth,
          h: img.dom().naturalHeight
        };
        viewRectState.set(viewRect);
        const rect = Rect.inflate(viewRect, -20, -20);
        rectState.set(rect);

        if (lastViewRect.w !== viewRect.w || lastViewRect.h !== viewRect.h) {
          zoomFit(panel, img);
        }

        repaintImg(panel, img);
        return img;
      });
    });
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:31,代码来源:ImagePanel.ts

示例6: n

 NamedChain.write('container', Chain.async((input, n, die) => {
   const container = Element.fromTag('div');
   Attr.set(container, 'id', 'test-container-div');
   Html.set(container, containerHtml);
   Insert.append(Body.body(), container);
   n(container);
 })),
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:InlineEditorInsideTableTest.ts

示例7: getCurrent

  return Future.nu(function (callback) {
    const getCurrent = Fun.curry(getScrollTop, element);
    Attr.set(element, lastScroll, getCurrent());

    const update = function (newScroll, abort) {
      const previous = DataAttributes.safeParse(element, lastScroll);
      // As soon as we detect a scroll value that we didn't set, assume the user
      // is scrolling, and abort the scrolling.
      if (previous !== element.dom().scrollTop) {
        abort(element.dom().scrollTop);
      } else {
        element.dom().scrollTop = newScroll;
        Attr.set(element, lastScroll, newScroll);
      }
    };

    const finish = function (/* dest */) {
      element.dom().scrollTop = destination;
      Attr.set(element, lastScroll, destination);
      callback(destination);
    };

    // Identify the number of steps based on distance (consistent time)
    const distance = Math.abs(destination - getCurrent());
    const step = Math.ceil(distance / NUM_TOP_ANIMATION_FRAMES);
    animator.animate(getCurrent, destination, step, update, finish, ANIMATION_RATE);
  });
开发者ID:abstask,项目名称:tinymce,代码行数:27,代码来源:IosScrolling.ts

示例8: function

const appendStyle = function (editor: Editor, text: string) {
  const head = Element.fromDom(editor.getDoc().head);
  const tag = Element.fromTag('style');
  Attr.set(tag, 'type', 'text/css');
  Insert.append(tag, Element.fromText(text));
  Insert.append(head, tag);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:InitContentBody.ts

示例9: function

const insert = function (editor, columns, rows) {
  let tableElm;

  const renderedHtml = TableRender.render(rows, columns, 0, 0);

  Attr.set(renderedHtml, 'id', '__mce');

  const html = Html.getOuter(renderedHtml);

  editor.insertContent(html);

  tableElm = editor.dom.get('__mce');
  editor.dom.setAttrib(tableElm, 'id', null);

  editor.$('tr', tableElm).each(function (index, row) {
    editor.fire('newrow', {
      node: row
    });

    editor.$('th,td', row).each(function (index, cell) {
      editor.fire('newcell', {
        node: cell
      });
    });
  });

  editor.dom.setAttribs(tableElm, editor.settings.table_default_attributes || {});
  editor.dom.setStyles(tableElm, editor.settings.table_default_styles || {});

  selectFirstCellInTable(editor, Element.fromDom(tableElm));

  return tableElm;
};
开发者ID:,项目名称:,代码行数:33,代码来源:


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