本文整理汇总了TypeScript中@ephox/alloy.Attachment.attachSystemAfter方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Attachment.attachSystemAfter方法的具体用法?TypeScript Attachment.attachSystemAfter怎么用?TypeScript Attachment.attachSystemAfter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.Attachment
的用法示例。
在下文中一共展示了Attachment.attachSystemAfter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const renderUI = function () {
const targetNode = editor.getElement();
const cssUrls = CssUrls.derive(editor);
if (Settings.isSkinDisabled(editor) === false) {
editor.contentCSS.push(cssUrls.content);
DOMUtils.DOM.styleSheetLoader.load(cssUrls.ui, SkinLoaded.fireSkinLoaded(editor));
} else {
SkinLoaded.fireSkinLoaded(editor)();
}
const doScrollIntoView = function () {
editor.fire('ScrollIntoView');
};
const realm = PlatformDetection.detect().os.isAndroid() ? AndroidRealm(doScrollIntoView) : IosRealm(doScrollIntoView);
const original = Element.fromDom(targetNode);
Attachment.attachSystemAfter(original, realm.system());
const findFocusIn = function (elem) {
return Focus.search(elem).bind(function (focused) {
return realm.system().getByDom(focused).toOption();
});
};
const outerWindow = targetNode.ownerDocument.defaultView;
const orientation = Orientation.onChange(outerWindow, {
onChange () {
const alloy = realm.system();
alloy.broadcastOn([ TinyChannels.orientationChanged() ], { width: Orientation.getActualWidth(outerWindow) });
},
onReady: Fun.noop
});
const setReadOnly = function (dynamicGroup, readOnlyGroups, mainGroups, ro) {
if (ro === false) {
editor.selection.collapse();
}
const toolbars = configureToolbar(dynamicGroup, readOnlyGroups, mainGroups);
realm.setToolbarGroups(ro === true ? toolbars.readOnly : toolbars.main);
editor.setMode(ro === true ? 'readonly' : 'design');
editor.fire(ro === true ? READING() : EDITING());
realm.updateMode(ro);
};
const configureToolbar = function (dynamicGroup, readOnlyGroups, mainGroups) {
const dynamic = dynamicGroup.get();
const toolbars = {
readOnly: dynamic.backToMask.concat(readOnlyGroups.get()),
main: dynamic.backToMask.concat(mainGroups.get())
};
if (Settings.readOnlyOnInit(editor)) {
toolbars.readOnly = dynamic.backToMask.concat(readOnlyGroups.get());
toolbars.main = dynamic.backToReadOnly.concat(mainGroups.get());
}
return toolbars;
};
const bindHandler = function (label, handler) {
editor.on(label, handler);
return {
unbind () {
editor.off(label);
}
};
};
editor.on('init', function () {
realm.init({
editor: {
getFrame () {
return Element.fromDom(editor.contentAreaContainer.querySelector('iframe'));
},
onDomChanged () {
return {
unbind: Fun.noop
};
},
onToReading (handler) {
return bindHandler(READING(), handler);
},
onToEditing (handler) {
return bindHandler(EDITING(), handler);
},
onScrollToCursor (handler) {
editor.on('ScrollIntoView', function (tinyEvent) {
handler(tinyEvent);
});
const unbind = function () {
editor.off('ScrollIntoView');
orientation.destroy();
};
//.........这里部分代码省略.........
示例2: loadIframeSkin
const render = (editor: Editor, uiComponents: RenderUiComponents, rawUiConfig: RenderUiConfig, backstage: UiFactoryBackstage, args: RenderArgs): ModeRenderInfo => {
loadIframeSkin(editor);
Attachment.attachSystemAfter(Element.fromDom(args.targetNode), uiComponents.mothership);
Attachment.attachSystem(Body.body(), uiComponents.uiMothership);
editor.on('init', () => {
OuterContainer.setToolbar(
uiComponents.outerContainer,
identifyButtons(editor, rawUiConfig, {backstage}, Option.none())
);
OuterContainer.setMenubar(
uiComponents.outerContainer,
identifyMenus(editor, rawUiConfig)
);
OuterContainer.setSidebar(
uiComponents.outerContainer,
rawUiConfig.sidebar
);
// Force an update of the ui components disabled states if in readonly mode
if (editor.readonly) {
handleSwitchMode(uiComponents)({mode: 'readonly'});
}
setupEvents(editor);
});
const socket = OuterContainer.getSocket(uiComponents.outerContainer).getOrDie('Could not find expected socket element');
editor.on('SwitchMode', handleSwitchMode(uiComponents));
if (Settings.isReadOnly(editor)) {
editor.setMode('readonly');
}
editor.addCommand('ToggleSidebar', (ui: boolean, value: string) => {
OuterContainer.toggleSidebar(uiComponents.outerContainer, value);
editor.fire('ToggleSidebar');
});
editor.addQueryValueHandler('ToggleSidebar', () => {
return OuterContainer.whichSidebar(uiComponents.outerContainer);
});
const drawer = Settings.getToolbarDrawer(editor);
const refreshDrawer = () => {
const toolbar = OuterContainer.getToolbar(uiComponents.outerContainer);
toolbar.each(SplitToolbar.refresh);
};
if (drawer === Settings.ToolbarDrawer.sliding || drawer === Settings.ToolbarDrawer.floating) {
editor.on('ResizeContent', refreshDrawer);
}
return {
iframeContainer: socket.element().dom(),
editorContainer: uiComponents.outerContainer.element().dom(),
};
};