OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
/
ui
/
autocomplete
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:48 AM
rwxr-xr-x
📄
AutocompleteContext.ts
1.59 KB
02/20/2020 06:37:52 AM
rw-r--r--
📄
AutocompleteEditorEvents.ts
2.44 KB
02/20/2020 06:37:52 AM
rw-r--r--
📄
AutocompleteLookup.ts
2.41 KB
02/20/2020 06:37:53 AM
rw-r--r--
📄
Autocompleters.ts
1.29 KB
02/20/2020 06:37:53 AM
rw-r--r--
Editing: Autocompleters.ts
Close
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { ValueSchema } from '@ephox/boulder'; import { InlineContent } from '@ephox/bridge'; import { Obj, Arr, Unique } from '@ephox/katamari'; import Editor from 'tinymce/core/api/Editor'; export interface AutocompleterDatabase { dataset: Record<string, InlineContent.Autocompleter>; triggerChars: string[]; lookupByChar: (ch: string) => InlineContent.Autocompleter[]; } const register = (editor: Editor): AutocompleterDatabase => { const popups = editor.ui.registry.getAll().popups; const dataset = Obj.map(popups, (popup) => { return InlineContent.createAutocompleter(popup).fold( (err) => { throw new Error(ValueSchema.formatError(err)); }, (x) => x ); }); const triggerChars = Unique.stringArray( Obj.mapToArray(dataset, (v) => v.ch) ); const datasetValues = Obj.values(dataset); const lookupByChar = (ch: string): InlineContent.Autocompleter[] => { return Arr.filter(datasetValues, (dv) => dv.ch === ch); }; return { dataset, triggerChars, lookupByChar }; }; export { register };