RichText/Archived/Rooster/Rooster.gcomp/Support/node_modules/roosterjs/dist/rooster-amd.js
/**
     * Creates an instance of Editor
     * @param contentDiv The DIV HTML element which will be the container element of editor
     * @param options An optional options object to customize the editor
     */
Creates an instance of Editor
@param contentDiv The DIV HTML element which will be the container element of editor
@param options An optional options object to customize the editor
Creates an instance of Editor @param contentDiv The DIV HTML element which will be the container element of editor @param options An optional options object to customize the editor
function Editor(contentDiv, options) {
        var _this = this;
        if (options === void 0) { options = {}; }
        if (roosterjs_editor_dom_1.getTagOfNode(contentDiv) != 'DIV') {
            throw new Error('contentDiv must be an HTML DIV element');
        }
        this.core = createEditorCore_1.default(contentDiv, options);
        this.core.plugins.forEach(function (plugin) { return plugin.initialize(_this); });
        this.setContent(options.initialContent || contentDiv.innerHTML || '', false );
        this.eventDisposers = mapPluginEvents_1.default(this.core);
        if (options.additionalEditFeatures) {
            options.additionalEditFeatures.forEach(function (feature) { return _this.addContentEditFeature(feature); });
        }
        if (!options.omitContentEditableAttributeChanges && !contentDiv.isContentEditable) {
            contentDiv.setAttribute('contenteditable', 'true');
            var styles = contentDiv.style;
            styles.userSelect = styles.msUserSelect = styles.webkitUserSelect = 'text';
            this.contenteditableChanged = true;
        }
        adjustBrowserBehavior_1.default();
        this.triggerPluginEvent(9 , {}, true );
        this.core.corePlugins.typeInContainer.ensureTypeInElement(this.getFocusedPosition() || new roosterjs_editor_dom_1.Position(contentDiv, 0 ));
    }
function Editor ( contentDiv , options ) { var _this = this ; if ( options === void 0 ) { options = { } ; } if ( roosterjs_editor_dom_1 . getTagOfNode ( contentDiv ) != 'DIV' ) { throw new Error ( 'contentDiv must be an HTML DIV element' ) ; } this . core = createEditorCore_1 . default ( contentDiv , options ) ; this . core . plugins . forEach ( function ( plugin ) { return plugin . initialize ( _this ) ; } ) ; this . setContent ( options . initialContent || contentDiv . innerHTML || '' , false ) ; this . eventDisposers = mapPluginEvents_1 . default ( this . core ) ; if ( options . additionalEditFeatures ) { options . additionalEditFeatures . forEach ( function ( feature ) { return _this . addContentEditFeature ( feature ) ; } ) ; } if ( ! options . omitContentEditableAttributeChanges && ! contentDiv . isContentEditable ) { contentDiv . setAttribute ( 'contenteditable' , 'true' ) ; var styles = contentDiv . style ; styles . userSelect = styles . msUserSelect = styles . webkitUserSelect = 'text' ; this . contenteditableChanged = true ; } adjustBrowserBehavior_1 . default ( ) ; this . triggerPluginEvent ( 9 , { } , true ) ; this . core . corePlugins . typeInContainer . ensureTypeInElement ( this . getFocusedPosition ( ) || new roosterjs_editor_dom_1 . Position ( contentDiv , 0 ) ) ; }
Creates an instance of Editor
 @param contentDiv The DIV HTML element which will be the container element of editor
 @param options An optional options object to customize the editor
Creates an instance of Editor @param contentDiv The DIV HTML element which will be the container element of editor @param options An optional options object to customize the editor
// 1. Make sure all parameters are valid // 2. Store options values to local variables // 3. Initialize plugins // 4. Ensure initial content and its format /*triggerContentChangedEvent*/ // 5. Create event handler to bind DOM events // 6. Add additional content edit features to the editor if specified // 7. Make the container editable and set its selection styles // 8. Do proper change for browsers to disable some browser-specified behaviors. // 9. Let plugins know that we are ready /* EditorReady */ /*broadcast*/ // 10. Before give editor to user, make sure there is at least one DIV element to accept typing /* Begin */