Beispiel #1
0
 const onMousedown = DomEvent.bind(Element.fromDom(document), 'mousedown', function (evt) {
   Arr.each([ mothership, uiMothership ], function (ship) {
     ship.broadcastOn([ Channels.dismissPopups() ], {
       target: evt.target()
     });
   });
 });
Beispiel #2
0
 editor.serializer.addNodeFilter('details', function (elms) {
   Arr.each(elms, function (details) {
     const open = details.attr('data-mce-open');
     details.attr('open', Type.isString(open) ? open : null);
     details.attr('data-mce-open', null);
   });
 });
Beispiel #3
0
 const getStr = (sections: TestSection[]) => {
   const r = { };
   Arr.each(sections, (section) => {
     r[section.setting.key] = section.setting.value.getOr('{ default }');
   });
   return JSON.stringify(r, null, 2);
 };
Beispiel #4
0
const removeTrailingBr = function (elm) {
  const allBrs = SelectorFilter.descendants(elm, 'br');
  const brs = Arr.filter(getLastChildren(elm).slice(-1), ElementType.isBr);
  if (allBrs.length === brs.length) {
    Arr.each(brs, Remove.remove);
  }
};
Beispiel #5
0
const removeDataStyle = (table) => {
  const dataStyleCells = SelectorFilter.descendants(table, 'td[data-mce-style],th[data-mce-style]');
  Attr.remove(table, 'data-mce-style');
  Arr.each(dataStyleCells, function (cell) {
    Attr.remove(cell, 'data-mce-style');
  });
};
  const onNodeChange = Throttler.last(() => {
    const callbackMap = changeCallbacks.get();
    const annotations = Arr.sort(Obj.keys(callbackMap));
    Arr.each(annotations, (name) => {
      updateCallbacks(name, (data) => {
        const prev = data.previous.get();
        identify(editor, Option.some(name)).fold(
          () => {
            if (prev.isSome()) {
              // Changed from something to nothing.
              fireNoAnnotation(name);
              data.previous.set(Option.none());
            }
          },
          ({ uid, name, elements }) => {
            // Changed from a different annotation (or nothing)
            if (! prev.is(uid)) {
              fireCallbacks(name, uid, elements);
              data.previous.set(Option.some(uid));
            }
          }
        );

        return {
          previous: data.previous,
          listeners: data.listeners
        };
      });
    });
  }, 30);
Beispiel #7
0
const hide = function (editor, body) {
  const nodeList = editor.dom.select(Data.selector, body);

  Arr.each(nodeList, function (node) {
    editor.dom.remove(node, 1);
  });
};
 editor.serializer.addNodeFilter('span', (spans) => {
   Arr.each(spans, (span) => {
     identifyParserNode(span).each((settings) => {
       if (settings.persistent === false) { span.unwrap(); }
     });
   });
 });
Beispiel #9
0
  const resetTargets = () => {
    // Reset the targets
    targets.set(Thunk.cached(findTargets)());

    // Trigger change handlers
    Arr.each(changeHandlers.get(), (handler) => handler());
  };
Beispiel #10
0
  Arr.each(SelectorFilter.descendants(table, 'tr'), (row) => {
    fireNewRow(editor, row.dom());

    Arr.each(SelectorFilter.descendants(row, 'th,td'), (cell) => {
      fireNewCell(editor, cell.dom());
    });
  });