OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
mobile
/
test
/
ts
/
module
/
test
/
ui
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:19 AM
rwxr-xr-x
📄
TestEditor.ts
1.31 KB
02/20/2020 06:40:21 AM
rw-r--r--
📄
TestFrameEditor.ts
2.38 KB
02/20/2020 06:40:22 AM
rw-r--r--
📄
TestSelectors.ts
174 bytes
02/20/2020 06:40:24 AM
rw-r--r--
📄
TestStyles.ts
1.28 KB
02/20/2020 06:40:23 AM
rw-r--r--
📄
TestUi.ts
2.1 KB
02/20/2020 06:40:24 AM
rw-r--r--
Editing: TestFrameEditor.ts
Close
import { Cursors, Waiter, Step, Assertions } from '@ephox/agar'; import { GuiFactory, AlloyComponent } from '@ephox/alloy'; import { Fun, Option } from '@ephox/katamari'; import { Attr, Element, Focus, WindowSelection } from '@ephox/sugar'; import TestEditor from './TestEditor'; export default function () { const frame = Element.fromTag('iframe'); Attr.set(frame, 'src', '/project/tinymce/src/themes/mobile/test/html/editor.html'); const sWaitForEditorLoaded = Waiter.sTryUntil( 'Waiting for iframe to load', Step.sync(() => { Assertions.assertEq('Check for a content editable body', 'true', frame.dom().contentWindow.document.body.contentEditable); }), 100, 8000 ); const config = { getFrame () { return frame; }, onDomChanged () { return { unbind: Fun.noop }; } }; const delegate = TestEditor(); const dEditor = delegate.editor(); const editor = { selection: { getStart () { return WindowSelection.getExact(frame.dom().contentWindow).map(function (sel) { return sel.start().dom(); }).getOr(null); }, getContent () { return frame.dom().contentWindow.document.body.innerHTML; }, select: Fun.noop }, getBody () { return frame.dom().contentWindow.document.body; }, insertContent: dEditor.insertContent, execCommand: dEditor.execCommand, dom: dEditor.dom, // Maybe this should be implemented focus () { Focus.focus(frame); const win = frame.dom().contentWindow; WindowSelection.getExact(win).orThunk(function () { const fbody = Element.fromDom(frame.dom().contentWindow.document.body); const elem = Cursors.calculateOne(fbody, [ 0 ]); WindowSelection.setExact(win, elem, 0, elem, 0); return Option.none(); }); }, ui: { registry: { getAll: () => { return { icons: {} }; } } } }; const component = GuiFactory.build( GuiFactory.external({ element: frame }) ); return { component: Fun.constant(component) as () => AlloyComponent, config: Fun.constant(config), editor: Fun.constant(editor), adder: delegate.adder, assertEq: delegate.assertEq, sAssertEq: delegate.sAssertEq, sWaitForEditorLoaded, sClear: delegate.sClear, sPrepareState: delegate.sPrepareState }; }