OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
/
ui
/
dialog
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:48 AM
rwxr-xr-x
📄
AlertDialog.ts
1.7 KB
02/20/2020 06:38:15 AM
rw-r--r--
📄
Autocomplete.ts
1.78 KB
02/20/2020 06:38:15 AM
rw-r--r--
📄
Bar.ts
689 bytes
02/20/2020 06:38:16 AM
rw-r--r--
📄
BodyPanel.ts
2.11 KB
02/20/2020 06:38:16 AM
rw-r--r--
📄
Collection.ts
5.65 KB
02/20/2020 06:38:17 AM
rw-r--r--
📄
ColorInput.ts
5.81 KB
02/20/2020 06:38:17 AM
rw-r--r--
📄
ColorPicker.ts
4.06 KB
02/20/2020 06:38:19 AM
rw-r--r--
📄
ConfirmDialog.ts
2.13 KB
02/20/2020 06:38:19 AM
rw-r--r--
📄
CustomEditor.ts
2.04 KB
02/20/2020 06:38:20 AM
rw-r--r--
📄
Dialogs.ts
3.91 KB
02/20/2020 06:38:20 AM
rw-r--r--
📄
Dropzone.ts
4.89 KB
02/20/2020 06:38:21 AM
rw-r--r--
📄
Grid.ts
735 bytes
02/20/2020 06:38:21 AM
rw-r--r--
📄
IFrame.ts
3.3 KB
02/20/2020 06:38:22 AM
rw-r--r--
📄
Label.ts
1.29 KB
02/20/2020 06:38:22 AM
rw-r--r--
📄
SelectBox.ts
2.37 KB
02/20/2020 06:38:23 AM
rw-r--r--
📄
SizeInput.ts
4.96 KB
02/20/2020 06:38:23 AM
rw-r--r--
📄
TabPanel.ts
5.41 KB
02/20/2020 06:38:24 AM
rw-r--r--
📄
Table.ts
1.52 KB
02/20/2020 06:38:24 AM
rw-r--r--
📄
TextField.ts
4.24 KB
02/20/2020 06:38:25 AM
rw-r--r--
📄
TypeAheadInput.ts
1.31 KB
02/20/2020 06:38:26 AM
rw-r--r--
📄
UrlInput.ts
9.25 KB
02/20/2020 06:38:26 AM
rw-r--r--
📄
WindowManager.ts
6.3 KB
02/20/2020 06:38:27 AM
rw-r--r--
📁
imagetools
-
02/20/2020 06:42:42 AM
rwxr-xr-x
Editing: IFrame.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 { Behaviour, Focusing, Tabstopping, FormField, AlloyComponent } from '@ephox/alloy'; import { Types } from '@ephox/bridge'; import { Cell, Option } from '@ephox/katamari'; import { PlatformDetection } from '@ephox/sand'; import { Attr } from '@ephox/sugar'; import { RepresentingConfigs } from '../alien/RepresentingConfigs'; import NavigableObject from '../general/NavigableObject'; import { renderLabel, renderFormFieldWith } from '../alien/FieldLabeller'; import { UiFactoryBackstageProviders } from '../../backstage/Backstage'; const platformNeedsSandboxing = !(PlatformDetection.detect().browser.isIE() || PlatformDetection.detect().browser.isEdge()); interface IFrameSourcing { getValue: (frame: AlloyComponent) => string; setValue: (frame: AlloyComponent, value: string) => void; } const getDynamicSource = (isSandbox): IFrameSourcing => { const cachedValue = Cell(''); return { getValue: (frameComponent: AlloyComponent): string => { // Ideally we should fetch data from the iframe...innerHtml, this triggers Corrs errors return cachedValue.get(); }, setValue: (frameComponent: AlloyComponent, html: string) => { if (!isSandbox) { Attr.set(frameComponent.element(), 'src', 'javascript:\'\''); // IE 6-11 doesn't support data uris on iframeComponents // and Edge only supports upto ~4000 chars in data uris // so I guess they will have to be less secure since we can't sandbox on those // TODO: Use sandbox if future versions of IE/Edge supports iframeComponents with data: uris. const doc = frameComponent.element().dom().contentWindow.document; doc.open(); doc.write(html); doc.close(); } else { Attr.set(frameComponent.element(), 'src', 'data:text/html;charset=utf-8,' + encodeURIComponent(html)); } cachedValue.set(html); } }; }; const renderIFrame = (spec: Types.Iframe.Iframe, providersBackstage: UiFactoryBackstageProviders) => { const isSandbox = platformNeedsSandboxing && spec.sandboxed; const attributes = { ...spec.label.map<{ title?: string }>((title) => ({title})).getOr({}), ...isSandbox ? { sandbox : 'allow-scripts allow-same-origin' } : { } }; const sourcing = getDynamicSource(isSandbox); const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage)); const factory = (newSpec: { uid: string }) => { return NavigableObject.craft( { // We need to use the part uid or the label and field won't be linked with ARIA uid: newSpec.uid, dom: { tag: 'iframe', attributes }, behaviours: Behaviour.derive([ Tabstopping.config({ }), Focusing.config({ }), RepresentingConfigs.withComp(Option.none(), sourcing.getValue, sourcing.setValue) ]) } ); }; // Note, it's not going to handle escape at this point. const pField = FormField.parts().field({ factory: { sketch: factory } }); return renderFormFieldWith(pLabel, pField, ['tox-form__group--stretched']); }; export { renderIFrame };