Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _shouldCallBlurDefault = (nextTarget: HTMLElement): boolean => {
// don't call blur if the next target is an element on this container
if (nextTarget && this._containerDiv.contains(nextTarget)) {
return false;
}
// similarly, don't call blur if the next target is the callout or its children
if (nextTarget == null && Browser.isIE) {
nextTarget = document.activeElement as HTMLElement;
}
if (nextTarget && closest(nextTarget, `.${this._calloutClassName}`)) {
return false;
}
return true;
};
EditorPlugin,
isCharacterValue,
isModifierKey,
} from 'roosterjs-editor-core';
// Character codes.
// IE11 uses different character codes. which are noted below.
// If adding a new key, test in IE to figure out what the code is.
const BACKSPACE_CHARCODE = 'Backspace';
const TAB_CHARCODE = 'Tab';
const ENTER_CHARCODE = 'Enter';
const ESC_CHARCODE = !Browser.isIE ? 'Escape' : 'Esc';
const LEFT_ARROW_CHARCODE = !Browser.isIE ? 'ArrowLeft' : 'Left';
const UP_ARROW_CHARCODE = !Browser.isIE ? 'ArrowUp' : 'Up';
const RIGHT_ARROW_CHARCODE = !Browser.isIE ? 'ArrowRight' : 'Right';
const DOWN_ARROW_CHARCODE = !Browser.isIE ? 'ArrowDown' : 'Down';
const DELETE_CHARCODE = !Browser.isIE ? 'Delete' : 'Del';
// Input event input types.
const DELETE_CONTENT_BACKWARDS_INPUT_TYPE = 'deleteContentBackwards';
// Unidentified key, the code for Android keyboard events.
const UNIDENTIFIED_KEY = 'Unidentified';
/**
* Interface for PickerPlugin
*/
export interface EditorPickerPluginInterface
extends EditorPlugin {
dataProvider: T;
}
} from 'roosterjs-editor-types';
import {
cacheGetContentSearcher,
Editor,
EditorPlugin,
isCharacterValue,
isModifierKey,
} from 'roosterjs-editor-core';
// Character codes.
// IE11 uses different character codes. which are noted below.
// If adding a new key, test in IE to figure out what the code is.
const BACKSPACE_CHARCODE = 'Backspace';
const TAB_CHARCODE = 'Tab';
const ENTER_CHARCODE = 'Enter';
const ESC_CHARCODE = !Browser.isIE ? 'Escape' : 'Esc';
const LEFT_ARROW_CHARCODE = !Browser.isIE ? 'ArrowLeft' : 'Left';
const UP_ARROW_CHARCODE = !Browser.isIE ? 'ArrowUp' : 'Up';
const RIGHT_ARROW_CHARCODE = !Browser.isIE ? 'ArrowRight' : 'Right';
const DOWN_ARROW_CHARCODE = !Browser.isIE ? 'ArrowDown' : 'Down';
const DELETE_CHARCODE = !Browser.isIE ? 'Delete' : 'Del';
// Input event input types.
const DELETE_CONTENT_BACKWARDS_INPUT_TYPE = 'deleteContentBackwards';
// Unidentified key, the code for Android keyboard events.
const UNIDENTIFIED_KEY = 'Unidentified';
/**
* Interface for PickerPlugin
*/
export interface EditorPickerPluginInterface
export function getDefaultContentEditFeatures(): ContentEditFeatures {
return {
autoLink: true,
indentWhenTab: true,
outdentWhenShiftTab: true,
outdentWhenBackspaceOnEmptyFirstLine: true,
outdentWhenEnterOnEmptyLine: Browser.isIE,
mergeInNewLineWhenBackspaceOnFirstChar: false,
unquoteWhenBackspaceOnEmptyFirstLine: true,
unquoteWhenEnterOnEmptyLine: true,
autoBullet: true,
tabInTable: true,
upDownInTable: Browser.isChrome || Browser.isSafari,
insertLineBeforeStructuredNodeFeature: false,
defaultShortcut: true,
unlinkWhenBackspaceAfterLink: false,
noCycleCursorMove: Browser.isChrome,
smartOrderedList: false,
smartOrderedListStyles: ['lower-alpha', 'lower-roman', 'decimal'],
};
}
Undo
{this.renderSpan(format.canUndo, 'Can Undo')}
{this.renderSpan(format.canRedo, 'Can Redo')}
Browser
{this.renderSpan(Browser.isChrome, 'Chrome')}
{this.renderSpan(Browser.isEdge, 'Edge')}
{this.renderSpan(Browser.isFirefox, 'Firefox')}
{this.renderSpan(Browser.isIE11OrGreater, 'IE10/11')}
{this.renderSpan(Browser.isIE, 'IE')}
{this.renderSpan(Browser.isIEOrEdge, 'IE/Edge')}
{this.renderSpan(Browser.isSafari, 'Safari')}
{this.renderSpan(Browser.isWebKit, 'Webkit')}
OS
{this.renderSpan(Browser.isMac, 'MacOS')}
{this.renderSpan(Browser.isWin, 'Windows')}
User Agent
{window.navigator.userAgent}