Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const setSelection = editor.setSelection.getOrThunk(function () {
return function (start, soffset, finish, foffset) {
WindowSelection.setExact(win, start, soffset, finish, foffset);
};
});
const clearSelection = editor.clearSelection.getOrThunk(function () {
return function () {
WindowSelection.clear(win);
};
});
return {
body: Fun.constant(body),
doc: Fun.constant(doc),
win: Fun.constant(win),
html: Fun.constant(html),
getSelection: Fun.curry(getSelectionFromFrame, frame),
setSelection,
clearSelection,
frame: Fun.constant(frame),
onKeyup: getOrListen(editor, doc, 'onKeyup', 'keyup'),
onNodeChanged: getOrListen(editor, doc, 'onNodeChanged', 'SelectionChange'),
onDomChanged: editor.onDomChanged, // consider defaulting with MutationObserver
onScrollToCursor: editor.onScrollToCursor,
onScrollToElement: editor.onScrollToElement,
onToReading: editor.onToReading,
onToEditing: editor.onToEditing,
onToolbarScrollStart: editor.onToolbarScrollStart,
import { FieldProcessorAdt, FieldSchema } from '@ephox/boulder';
import { Fun, Option } from '@ephox/katamari';
import * as Behaviour from '../../api/behaviour/Behaviour';
import { Focusing } from '../../api/behaviour/Focusing';
import { Keying } from '../../api/behaviour/Keying';
import { Toggling } from '../../api/behaviour/Toggling';
import { Toolbar } from '../../api/ui/Toolbar';
import * as SplitToolbarBase from '../common/SplitToolbarBase';
import * as Fields from '../../data/Fields';
import * as PartType from '../../parts/PartType';
import { SplitFloatingToolbarDetail } from '../types/SplitFloatingToolbarTypes';
import * as AlloyParts from '../../parts/AlloyParts';
import * as ToolbarSchema from './ToolbarSchema';
const schema: () => FieldProcessorAdt[] = Fun.constant([
Fields.markers([ 'overflowToggledClass' ]),
FieldSchema.strict('getAnchor'),
FieldSchema.strict('lazySink')
].concat(
SplitToolbarBase.schema()
));
const parts: () => PartType.PartTypeAdt[] = Fun.constant([
PartType.required({
factory: Toolbar,
schema: ToolbarSchema.schema(),
name: 'primary'
}),
PartType.external({
factory: Toolbar,
const bounds = (x: number, y: number, width: number, height: number): Bounds => {
return {
x: Fun.constant(x),
y: Fun.constant(y),
width: Fun.constant(width),
height: Fun.constant(height),
right: Fun.constant(x + width),
bottom: Fun.constant(y + height)
};
};
FieldSchema.defaulted('apis', { }),
FieldSchema.defaulted('state', NoState),
FieldSchema.defaulted('extra', { })
]);
const createModes = (data: BehaviourModeSpec): AlloyBehaviour => {
const value: BehaviourModeSpec = ValueSchema.asRawOrDie('Creating behaviour: ' + data.name, modeSchema, data);
return CommonBehaviour.createModes(
ValueSchema.choose(value.branchKey, value.branches),
value.name, value.active, value.apis, value.extra, value.state
);
};
const revoke = Fun.constant(undefined);
const noActive = Fun.constant({ });
const noApis = Fun.constant({ });
const noExtra = Fun.constant({ });
export {
derive,
revoke,
noActive,
noApis,
noExtra,
create,
createModes
};
getNotificationManagerImpl () {
return {
open: Fun.constant({
progressBar: { value: Fun.noop },
close: Fun.noop,
text: Fun.noop,
getEl: Fun.constant(null),
moveTo: Fun.noop,
moveRel: Fun.noop,
settings: {} as NotificationSpec
}),
close: Fun.noop,
reposition: Fun.noop,
getArgs: Fun.constant({} as NotificationSpec)
};
},
renderUI
const bounds = (x: number, y: number, width: number, height: number): Bounds => {
return {
x: Fun.constant(x),
y: Fun.constant(y),
width: Fun.constant(width),
height: Fun.constant(height),
right: Fun.constant(x + width),
bottom: Fun.constant(y + height)
};
};
const toRect = function (rect) {
return {
left: Fun.constant(rect.left),
top: Fun.constant(rect.top),
right: Fun.constant(rect.right),
bottom: Fun.constant(rect.bottom),
width: Fun.constant(rect.width),
height: Fun.constant(rect.height)
};
};
const bounds = (x: number, y: number, width: number, height: number): Bounds => {
return {
x: Fun.constant(x),
y: Fun.constant(y),
width: Fun.constant(width),
height: Fun.constant(height),
right: Fun.constant(x + width),
bottom: Fun.constant(y + height)
};
};
const bounds = (x: number, y: number, width: number, height: number): Bounds => {
return {
x: Fun.constant(x),
y: Fun.constant(y),
width: Fun.constant(width),
height: Fun.constant(height),
right: Fun.constant(x + width),
bottom: Fun.constant(y + height)
};
};