當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。