How to use the roosterjs-editor-core.Editor function in roosterjs-editor-core

To help you get started, we’ve selected a few roosterjs-editor-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / roosterjs-react / packages / roosterjs-react-editor / lib / components / LeanRooster.tsx View on Github external
public componentDidMount(): void {
        const { readonly, activateRoosterOnMount, activateInViewMode } = this.props;

        if (!readonly && activateRoosterOnMount) {
            if (activateInViewMode) {
                this._editor = new Editor(this._contentDiv, this._editorOptions);
                this._updateContentToViewState(true /* isInitializing */);
            } else {
                this._trySwithToEditMode();
            }
        } else if (!this._hasPlaceholder) {
            this._refreshPlaceholder();
        }
    }
github microsoft / roosterjs / packages / roosterjs / lib / createEditor.ts View on Github external
let plugins: EditorPlugin[] = [new HyperLink(), new Paste(), new ContentEdit()];

    if (additionalPlugins) {
        plugins = plugins.concat(additionalPlugins);
    }

    let options: EditorOptions = {
        plugins: plugins,
        initialContent: initialContent,
        defaultFormat: {
            fontFamily: 'Calibri,Arial,Helvetica,sans-serif',
            fontSize: '11pt',
            textColor: '#000000',
        },
    };
    return new Editor(contentDiv, options);
}
github microsoft / roosterjs-react / packages / roosterjs-react-editor / lib / components / LeanRooster.tsx View on Github external
if (readonly) {
            return false;
        }
        if (this.mode === LeanRoosterModes.Edit) {
            if (alwaysForceUpdateForEditMode) {
                this.forceUpdate();
            }
            return false;
        }
        if (onBeforeModeChange(LeanRoosterModes.Edit)) {
            return;
        }
        const isInitializing = !this._editor;
        if (isInitializing) {
            this._editor = new Editor(this._contentDiv, this._editorOptions);
        }
        this._mode = LeanRoosterModes.Edit;

        this._updateContentToViewState(isInitializing);
        this.forceUpdate();
        onAfterModeChange(LeanRoosterModes.Edit);

        return true;
    }
github microsoft / roosterjs-react / sample / script / ReactEditor.tsx View on Github external
componentDidMount() {
        this.editor = new Editor(this.contentDiv, this.getEditorOptions());
        this.updateViewStateWhenUnmount = true;
        this.updateContentToViewState(true /*isInitializing*/);
    }
github microsoft / roosterjs / publish / samplesite / scripts / controls / editor / Editor.tsx View on Github external
: null,
            customReplace: pluginList.customReplace ? new CustomReplacePlugin() : null,
        };
        let plugins = [
            ...Object.keys(editorInstanceToggleablePlugins).map(
                k => (editorInstanceToggleablePlugins as any)[k]
            ),
            ...this.props.plugins,
        ];
        let defaultFormat = { ...this.state.defaultFormat };
        let options: EditorOptions = {
            plugins: plugins,
            defaultFormat: defaultFormat,
            undo: this.props.undo,
        };
        this.editor = new RoosterJsEditor(this.contentDiv, options);
    }
github microsoft / roosterjs / publish / samplesite / scripts / initOptions.ts View on Github external
}
    const textColor = (document.getElementById('textColorDefaultFormat') as HTMLInputElement).value;
    if (textColor) {
        defaultFormat.textColor = textColor;
    }
    const fontFamily = (document.getElementById('fontNameDefaultFormat') as HTMLInputElement).value;
    if (fontFamily) {
        defaultFormat.fontFamily = fontFamily;
    }
    let editorOptions: EditorOptions = {
        plugins: plugins,
        defaultFormat: defaultFormat
    };

    setCurrentEditor(
        new Editor(document.getElementById('editor') as HTMLDivElement, editorOptions)
    );

    updateSampleCode(plugins, defaultFormat, featuresChanged && features);
}