Sha256: c14cd22432fec2a63c62bb3536cc9affea65f6385ced95406f7febb5fce57abb

Contents?: true

Size: 961 Bytes

Versions: 32

Compression:

Stored size: 961 Bytes

Contents

(() => {
  const codeMirrorInstances = [];
  window.CMS.codemirror = {
    init(root = document) {
      for (const textarea of root.querySelectorAll('textarea[data-cms-cm-mode]')) {
        const codemirror = CodeMirror.fromTextArea(textarea, {
          mode: textarea.dataset.cmsCmMode,
          tabSize: 2,
          lineWrapping: true,
          autoCloseTags: true,
          lineNumbers: true,
          viewportMargin: Infinity
        });
        codeMirrorInstances.push(codemirror);
      }

      const tabsRoot = root.id === 'form-fragments' ? root : root.querySelector('#form-fragments');
      jQuery(tabsRoot).find('a[data-toggle="tab"]').on('shown.bs.tab', () => {
        for (const codemirror of codeMirrorInstances) {
          codemirror.refresh();
        }
      });
    },
    dispose() {
      for (const codemirror of codeMirrorInstances) {
        codemirror.toTextArea();
      }
      codeMirrorInstances.length = 0;
    }
}
})();

Version data entries

32 entries across 32 versions & 8 rubygems

Version Path
kcyEtsTest2-0.0.2 app/assets/javascripts/comfy/admin/cms/codemirror.js
kcyEtsTest2-0.0.1 app/assets/javascripts/comfy/admin/cms/codemirror.js
kcyEtsTest-0.0.1 app/assets/javascripts/comfy/admin/cms/codemirror.js
kcyEtsTest-2.2.19 app/assets/javascripts/comfy/admin/cms/codemirror.js
ComfortableMexicanSofa-2.0.18 app/assets/javascripts/comfy/admin/cms/codemirror.js
kcy1-1.0 app/assets/javascripts/comfy/admin/cms/codemirror.js
comfortable_mexican_sofa-2.0.18 app/assets/javascripts/comfy/admin/cms/codemirror.js
comfortable_mexican_sofa-2.0.17 app/assets/javascripts/comfy/admin/cms/codemirror.js
comfortable_mexican_sofa-2.0.16 app/assets/javascripts/comfy/admin/cms/codemirror.js
comfortable_mexican_sofa-2.0.15 app/assets/javascripts/comfy/admin/cms/codemirror.js
comfortable_mexican_sofa-2.0.14 app/assets/javascripts/comfy/admin/cms/codemirror.js
comfortable_mexican_sofa-2.0.13 app/assets/javascripts/comfy/admin/cms/codemirror.js