Logger.t('Editor element properties', Step.sync(function () {
          const body = Element.fromDom(document.body);
          const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');
          const iframeContainerElement = SelectorFind.descendant(body, '#' + editor.id + '_iframecontainer').getOrDie('No elm');

          Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
          Assertions.assertDomEq('Should be expected iframe container element element', iframeContainerElement, Element.fromDom(editor.contentAreaContainer));
        }))
        Logger.t('Editor element properties', Step.sync(function () {
          const body = Element.fromDom(document.body);
          const targetElement = SelectorFind.descendant(body, '#' + editor.id).getOrDie('No elm');
          const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');

          Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
          Assertions.assertDomEq('Should be expected editor body element', targetElement, Element.fromDom(editor.getBody()));
          Assertions.assertDomEq('Should be expected editor target element', targetElement, Element.fromDom(editor.getElement()));
          Assertions.assertEq('Should be undefined for inline mode', undefined, editor.contentAreaContainer);
        }))
  const removeContentEditableSelection = function () {
    if (selectedContentEditableNode) {
      selectedContentEditableNode.removeAttribute('data-mce-selected');
      SelectorFind.descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(Remove.remove);
      selectedContentEditableNode = null;
    }

    SelectorFind.descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(Remove.remove);
    selectedContentEditableNode = null;
  };
Example #4
0
 return Step.sync(function () {
   const elm = createViewElement(html);
   const location = createLocation(elm, elementPath, offset);
   Assertions.assertEq('Should be a valid location: ' + html, true, location.isSome());
   Assertions.assertEq('Should be expected location', expectedLocationName, locationName(location.getOrDie()));
   Assertions.assertDomEq('Should be expected element', SelectorFind.descendant(elm, expectedInline).getOrDie(), locationElement(location.getOrDie()));
 });
Example #5
0
 onReceive: (comp, data) => {
   // Send the message to the iframe via postMessage
   SelectorFind.descendant(comp.element(), 'iframe').each((iframeEle) => {
     const iframeWin = iframeEle.dom().contentWindow;
     iframeWin.postMessage(data, iframeDomain);
   });
 }
Example #6
0
      AlloyEvents.runOnAttached((comp) => {
        SelectorFind.descendant(comp.element(), '[role="tabpanel"]').each((tabview) => {
          Css.set(tabview, 'visibility', 'hidden');

          // Determine the maximum heights of each tab
          comp.getSystem().getByDom(tabview).toOption().each((tabviewComp) => {
            const heights = measureHeights(allTabs, tabview, tabviewComp);

            // Calculate the maximum tab height and store it
            const maxTabHeightOpt = getMaxHeight(heights);
            maxTabHeight.set(maxTabHeightOpt);
          });

          // Set an initial height, based on the current size
          updateTabviewHeight(comp.element(), tabview, maxTabHeight);

          // Show the tabs
          Css.remove(tabview, 'visibility');
          showTab(allTabs, comp);

          // Use a delay here and recalculate the height, as we need all the components attached
          // to be able to properly calculate the max height
          Delay.requestAnimationFrame(() => {
            updateTabviewHeight(comp.element(), tabview, maxTabHeight);
          });
        });
      }),
Example #7
0
const setupUiContainer = function (editor) {
  if (editor.settings.ui_container) {
    Env.container = SelectorFind.descendant(Element.fromDom(document.body), editor.settings.ui_container).fold(Fun.constant(null), function (elm) {
      return elm.dom();
    });
  }
};
Example #8
0
 const getButton = (selector: string) => {
   return component.getSystem().getByDom(
     SelectorFind.descendant(component.element(), selector).getOrDie(
       `Could not find button defined by: ${selector}`
     )
   ).getOrDie();
 };
Example #9
0
 setActive: (state) => {
   // Toggle the pressed aria state component
   Attr.set(comp.element(), 'aria-pressed', state);
   // Toggle the inner button state, as that's the toggle component of the split button
   SelectorFind.descendant(comp.element(), 'span').each((button) => {
     comp.getSystem().getByDom(button).each((buttonComp) => Toggling.set(buttonComp, state));
   });
 },
Example #10
0
 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');
   }
 })