本文整理匯總了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(),
};
};