OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
/
ui
/
window
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:48 AM
rwxr-xr-x
📄
DialogChannels.ts
659 bytes
02/20/2020 06:39:09 AM
rw-r--r--
📄
SilverDialog.ts
2.28 KB
02/20/2020 06:39:11 AM
rw-r--r--
📄
SilverDialogBody.ts
3.49 KB
02/20/2020 06:39:10 AM
rw-r--r--
📄
SilverDialogCommon.ts
5.04 KB
02/20/2020 06:39:11 AM
rw-r--r--
📄
SilverDialogEvents.ts
4.24 KB
02/20/2020 06:39:12 AM
rw-r--r--
📄
SilverDialogFooter.ts
3.33 KB
02/20/2020 06:39:12 AM
rw-r--r--
📄
SilverDialogHeader.ts
3.64 KB
02/20/2020 06:39:13 AM
rw-r--r--
📄
SilverDialogInstanceApi.ts
4.83 KB
02/20/2020 06:39:13 AM
rw-r--r--
📄
SilverInlineDialog.ts
4.17 KB
02/20/2020 06:39:14 AM
rw-r--r--
📄
SilverUrlDialog.ts
5.45 KB
02/20/2020 06:39:15 AM
rw-r--r--
📄
SilverUrlDialogInstanceApi.ts
1.52 KB
02/20/2020 06:39:15 AM
rw-r--r--
Editing: SilverDialogHeader.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 { AlloySpec, AlloyTriggers, Behaviour, Button, Container, DomFactory, Dragging, GuiFactory, ModalDialog, Reflecting, } from '@ephox/alloy'; import { Option } from '@ephox/katamari'; import { SelectorFind } from '@ephox/sugar'; import { UiFactoryBackstageProviders } from '../../backstage/Backstage'; import { formCancelEvent } from '../general/FormEvents'; import { titleChannel } from './DialogChannels'; export interface WindowHeaderFoo { title: string; draggable: boolean; } const renderClose = (providersBackstage: UiFactoryBackstageProviders) => { return Button.sketch({ dom: { tag: 'button', classes: ['tox-button', 'tox-button--icon', 'tox-button--naked'], attributes: { 'type': 'button', 'aria-label': providersBackstage.translate('Close'), 'title': providersBackstage.translate('Close'), // TODO tooltips: AP-213 } }, components: [ { dom: { tag: 'div', classes: ['tox-icon'], innerHtml: '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M17.953 7.453L13.422 12l4.531 4.547-1.406 1.406L12 13.422l-4.547 4.531-1.406-1.406L10.578 12 6.047 7.453l1.406-1.406L12 10.578l4.547-4.531z" fill-rule="evenodd"></path></svg>' } } ], action: (comp) => { AlloyTriggers.emit(comp, formCancelEvent); } }); }; const renderTitle = (foo: WindowHeaderFoo, id: Option<string>, providersBackstage: UiFactoryBackstageProviders): AlloySpec => { const renderComponents = (data: WindowHeaderFoo) => [ GuiFactory.text(providersBackstage.translate(data.title)) ]; return { dom: { tag: 'div', classes: [ 'tox-dialog__title' ], attributes: { ...id.map((x) => ({id: x}) as {id?: string}).getOr({}) } }, components: renderComponents(foo), behaviours: Behaviour.derive([ Reflecting.config({ channel: titleChannel, renderComponents }) ]) }; }; const renderInlineHeader = (foo: WindowHeaderFoo, titleId: string, providersBackstage: UiFactoryBackstageProviders): AlloySpec => { return Container.sketch({ dom: DomFactory.fromHtml('<div class="tox-dialog__header"></div>'), components: [ renderTitle(foo, Option.some(titleId), providersBackstage), renderClose(providersBackstage) ], containerBehaviours: Behaviour.derive([ Dragging.config({ mode: 'mouse', blockerClass: 'blocker', getTarget (handle) { return SelectorFind.closest(handle, '[role="dialog"]').getOrDie(); }, snaps: { getSnapPoints: () => [ ], leftAttr: 'data-drag-left', topAttr: 'data-drag-top' } }), ]) }); }; const renderModalHeader = (foo: WindowHeaderFoo, providersBackstage: UiFactoryBackstageProviders): AlloySpec => { const pTitle = ModalDialog.parts().title( renderTitle(foo, Option.none(), providersBackstage) ); const pHandle = ModalDialog.parts().draghandle({ dom: DomFactory.fromHtml('<div class="tox-dialog__draghandle"></div>') }); const pClose = ModalDialog.parts().close( renderClose(providersBackstage) ); const components = [ pTitle ].concat(foo.draggable ? [ pHandle ] : []).concat([ pClose ]); return Container.sketch({ dom: DomFactory.fromHtml('<div class="tox-dialog__header"></div>'), components }); }; export { renderInlineHeader, renderModalHeader };