How to use the @ephox/sugar.Attr.setAll function in @ephox/sugar

To help you get started, we’ve selected a few @ephox/sugar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinymce / tinymce / modules / tinymce / src / plugins / lists / main / ts / listModel / ComposeList.ts View on Github external
const createItem = (scope: Document, attr: Record, content: Element[]): Element => {
  const item = Element.fromTag('li', scope);
  Attr.setAll(item, attr);
  InsertAll.append(item, content);
  return item;
};
github tinymce / tinymce / src / core / main / ts / keyboard / TableNavigation.ts View on Github external
editor.undoManager.transact(() => {
      const element = SugarElement.fromTag(forcedRootBlock);
      Attr.setAll(element, Settings.getForcedRootBlockAttrs(editor));
      Insert.append(element, SugarElement.fromTag('br'));

      if (down) {
        Insert.after(SugarElement.fromDom(table), element);
      } else {
        Insert.before(SugarElement.fromDom(table), element);
      }

      const rng = editor.dom.createRng();
      rng.setStart(element.dom(), 0);
      rng.setEnd(element.dom(), 0);
      moveToRange(editor, rng);
    });
  } else {
github tinymce / tinymce / modules / tinymce / src / core / main / ts / annotate / Wrapping.ts View on Github external
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;
};
github tinymce / tinymce / modules / tinymce / src / plugins / lists / main / ts / listModel / ComposeList.ts View on Github external
Arr.last(segments).each((segment) => {
    Attr.setAll(segment.list, entry.listAttributes);
    Attr.setAll(segment.item, entry.itemAttributes);
    InsertAll.append(segment.item, entry.content);
  });
};
github tinymce / tinymce / modules / tinymce / src / plugins / lists / main / ts / listModel / ComposeList.ts View on Github external
Arr.last(segments).each((segment) => {
    Attr.setAll(segment.list, entry.listAttributes);
    Attr.setAll(segment.item, entry.itemAttributes);
    InsertAll.append(segment.item, entry.content);
  });
};
github tinymce / tinymce / src / core / main / ts / keyboard / ContentEndpointNavigation.ts View on Github external
const insertBlock = (root: Element, forward: boolean, blockName: string, attrs: Record) => {
  const block = Element.fromTag(blockName);
  const br = Element.fromTag('br');

  Attr.setAll(block, attrs);
  Insert.append(block, br);
  insertElement(root, block, forward);

  return rangeBefore(br);
};
github tinymce / tinymce / modules / tinymce / src / plugins / lists / main / ts / listModel / ComposeList.ts View on Github external
const normalizeSegment = (segment: Segment, entry: Entry): void => {
  if (Node.name(segment.list) !== entry.listType) {
    segment.list = Replication.mutate(segment.list, entry.listType);
  }
  Attr.setAll(segment.list, entry.listAttributes);
};