Exemplo n.º 1
0
    /**
     * Constructor.
     *
     * @param quill - The quill instance the theme is applying to.
     * @param options - The current options for the instance.
     */
    constructor(quill: Quill, options: QuillOptionsStatic) {
        const classesRichEditor = richEditorClasses(false);
        const themeOptions = {
            ...options,
            placeholder: "Create a new post...",
            scrollingContainer: "body",
        };

        super(quill, themeOptions);

        this.quill.root.classList.add(classesRichEditor.text);
        this.quill.root.classList.add("richEditor-text");
        this.quill.root.classList.add("userContent");

        // Add keyboard bindings to options.
        this.addModule("embed/insertion");
        this.addModule("embed/focus");
        const keyboardBindings = new KeyboardBindings(this.quill);
        this.options.modules.keyboard.bindings = {
            ...this.options.modules.keyboard.bindings,
            ...keyboardBindings.bindings,
        };

        // Attaches the markdown keyboard listener.
        const markdownModule = new MarkdownModule(this.quill);
        markdownModule.registerHandler();
    }
Exemplo n.º 2
0
    beforeEach(() => {
        const classesRichEditor = richEditorClasses(false);
        document.body.innerHTML = `<div>
            <div class="FormWrapper"><div id="quillNoEditor"></div></div>
            <div class=${classNames("richEditor", classesRichEditor.root)}><div id="quillNoForm"></div></div>
            <div class="FormWrapper">
                <button id="buttonBefore"></button>
                <div class=${classNames("richEditor", classesRichEditor.root)}>
                    <div id="quill"></div>
                    <button id="button1"></button>
                </div>
            </div>
        </div>`;

        quill = new Quill("#quill");
        embedFocusModule = new FocusModule(quill);
    });