How to use the roosterjs-editor-types.PluginEventType.MouseUp function in roosterjs-editor-types

To help you get started, we’ve selected a few roosterjs-editor-types 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 / packages / roosterjs-editor-core / lib / coreAPI / createEventHandlers.ts View on Github external
saveSelectionRange(core);
                      }
                  }
        ),
        new DOMEventHandler(core, 'keypress', PluginEventType.KeyPress, event => onKeyPress(core, event as KeyboardEvent)),
        new DOMEventHandler(core, 'keydown', PluginEventType.KeyDown),
        new DOMEventHandler(core, 'keyup', PluginEventType.KeyUp),
        new DOMEventHandler(core, 'compositionstart', null, () => (core.isInIME = true)),
        new DOMEventHandler(
            core,
            'compositionend',
            PluginEventType.CompositionEnd,
            () => (core.isInIME = false)
        ),
        new DOMEventHandler(core, 'mousedown', PluginEventType.MouseDown),
        new DOMEventHandler(core, 'mouseup', PluginEventType.MouseUp),
        new DOMEventHandler(core, 'mouseover', PluginEventType.MouseOver),
        new DOMEventHandler(core, 'mouseout', PluginEventType.MouseOut),
        new DOMEventHandler(core, 'paste', PluginEventType.Paste),
        new DOMEventHandler(core, 'copy', PluginEventType.Copy, () => {}),
        new DOMEventHandler(core, 'focus', PluginEventType.Focus, () => {
            // Restore the last saved selection first
            if (core.cachedSelectionRange && !core.disableRestoreSelectionOnFocus) {
                restoreSelection(core);
            }

            core.cachedSelectionRange = null;
        }),
    ];

    if (isIEorEdge) {
        // we do saving selection when editor loses focus, which normally can be done in onBlur event
github microsoft / roosterjs / packages / roosterjs-editor-core / lib / editor / Editor.ts View on Github external
private createEventHandlers() {
        this.eventDisposers = [
            attachDomEvent(this.core, 'input', null, this.stopPropagation),
            attachDomEvent(this.core, 'keypress', PluginEventType.KeyPress, this.onKeyPress),
            attachDomEvent(this.core, 'keydown', PluginEventType.KeyDown, this.stopPropagation),
            attachDomEvent(this.core, 'keyup', PluginEventType.KeyUp, this.stopPropagation),
            attachDomEvent(this.core, 'mousedown', PluginEventType.MouseDown),
            attachDomEvent(this.core, 'mouseup', PluginEventType.MouseUp),
            attachDomEvent(this.core, 'compositionstart', null, () => (this.inIME = true)),
            attachDomEvent(
                this.core,
                'compositionend',
                PluginEventType.CompositionEnd,
                () => (this.inIME = false)
            ),
            attachDomEvent(this.core, 'focus', null, () => {
                // Restore the last saved selection first
                if (this.core.cachedSelectionRange && !this.disableRestoreSelectionOnFocus) {
                    restoreSelection(this.core);
                }
                this.core.cachedSelectionRange = null;
            }),
            attachDomEvent(this.core, IS_IE_OR_EDGE ? 'beforedeactivate' : 'blur', null, () => {
                saveSelectionRange(this.core);
github microsoft / roosterjs-react / packages / roosterjs-react-ribbon / lib / plugins / RibbonPlugin.ts View on Github external
public onPluginEvent(event: PluginEvent): void {
        if (
            event.eventType == PluginEventType.KeyUp ||
            event.eventType == PluginEventType.MouseUp ||
            event.eventType == PluginEventType.ContentChanged
        ) {
            this.ribbons.forEach(ribbon => ribbon.onFormatChange());
        }
    }
github microsoft / roosterjs / publish / samplesite / scripts / controls / sidePane / formatState / FormatStatePlugin.ts View on Github external
onPluginEvent(event: PluginEvent) {
        if (
            event.eventType == PluginEventType.KeyUp ||
            event.eventType == PluginEventType.MouseUp ||
            event.eventType == PluginEventType.ContentChanged
        ) {
            this.updateFormatState();
        }
    }
github microsoft / roosterjs-react / packages / roosterjs-react-emoji / lib / plugins / EmojiPlugin.tsx View on Github external
public willHandleEventExclusively(event: PluginEvent): boolean {
        return this._isSuggesting && (event.eventType === PluginEventType.KeyDown || event.eventType === PluginEventType.KeyUp || event.eventType === PluginEventType.MouseUp);
    }
github microsoft / roosterjs / publish / samplesite / scripts / controls / sidePane / eventViewer / EventViewPane.tsx View on Github external
private renderEvent(event: PluginEvent): JSX.Element {
        switch (event.eventType) {
            case PluginEventType.KeyDown:
            case PluginEventType.KeyPress:
            case PluginEventType.KeyUp:
                return (
                    <span>
                        Key=
                        {event.rawEvent.which}
                    </span>
                );

            case PluginEventType.MouseDown:
            case PluginEventType.MouseUp:
                return (
                    <span>
                        Button=
                        {event.rawEvent.button}, SrcElement=
                        {event.rawEvent.target &amp;&amp; getTagOfNode(event.rawEvent.target as Node)},
                        PageX=
                        {event.rawEvent.pageX}, PageY=
                        {event.rawEvent.pageY}
                    </span>
                );

            case PluginEventType.ContentChanged:
                return (
                    <span>
                        Source=
                        {event.source}, Data=
</span>
github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / HyperLink / HyperLink.ts View on Github external
public onPluginEvent(event: PluginEvent): void {
        if (event.eventType == PluginEventType.MouseUp) {
            const anchor = this.editor.getElementAtCursor(
                'A',
                event.rawEvent.srcElement
            ) as HTMLAnchorElement;

            if (anchor) {
                if (this.onLinkClick) {
                    this.onLinkClick(anchor, event.rawEvent);
                    return;
                }

                let href: string;
                if (
                    !Browser.isFirefox &&
                    (href = this.tryGetHref(anchor)) &&
                    (Browser.isMac ? event.rawEvent.metaKey : event.rawEvent.ctrlKey)
github microsoft / roosterjs / publish / samplesite / scripts / controls / ribbon / RibbonPlugin.ts View on Github external
onPluginEvent(event: PluginEvent) {
        if (
            this.ribbon &&
            (event.eventType == PluginEventType.KeyUp ||
                event.eventType == PluginEventType.MouseUp ||
                event.eventType == PluginEventType.ContentChanged)
        ) {
            this.ribbon.forceUpdate();
        }
    }
}