MCPcopy
hub / github.com/basecamp/trix / constructor

Method constructor

action_text-trix/app/assets/javascripts/trix.js:12833–12860  ·  view source on GitHub ↗
(_ref)

Source from the content-addressed store, hash-verified

12831 const snapshotsAreEqual = (a, b) => rangesAreEqual(a.selectedRange, b.selectedRange) && a.document.isEqualTo(b.document);
12832 class EditorController extends Controller {
12833 constructor(_ref) {
12834 let {
12835 editorElement,
12836 document,
12837 html
12838 } = _ref;
12839 super(...arguments);
12840 this.editorElement = editorElement;
12841 this.selectionManager = new SelectionManager(this.editorElement);
12842 this.selectionManager.delegate = this;
12843 this.composition = new Composition();
12844 this.composition.delegate = this;
12845 this.attachmentManager = new AttachmentManager(this.composition.getAttachments());
12846 this.attachmentManager.delegate = this;
12847 this.inputController = input.getLevel() === 2 ? new Level2InputController(this.editorElement) : new Level0InputController(this.editorElement);
12848 this.inputController.delegate = this;
12849 this.inputController.responder = this.composition;
12850 this.compositionController = new CompositionController(this.editorElement, this.composition);
12851 this.compositionController.delegate = this;
12852 this.toolbarController = new ToolbarController(this.editorElement.toolbarElement);
12853 this.toolbarController.delegate = this;
12854 this.editor = new Editor(this.composition, this.selectionManager, this.editorElement);
12855 if (document) {
12856 this.editor.loadDocument(document);
12857 } else {
12858 this.editor.loadHTML(html);
12859 }
12860 }
12861 registerSelectionManager() {
12862 return selectionChangeObserver.registerSelectionManager(this.selectionManager);
12863 }

Callers

nothing calls this directly

Calls 3

loadDocumentMethod · 0.80
loadHTMLMethod · 0.80
getAttachmentsMethod · 0.45

Tested by

no test coverage detected