本文整理汇总了TypeScript中@ephox/sugar.SelectorFind.first方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SelectorFind.first方法的具体用法?TypeScript SelectorFind.first怎么用?TypeScript SelectorFind.first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.SelectorFind
的用法示例。
在下文中一共展示了SelectorFind.first方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const tag = function () {
const head = SelectorFind.first('head').getOrDie();
const nu = function () {
const meta = Element.fromTag('meta');
Attr.set(meta, 'name', 'viewport');
Insert.append(head, meta);
return meta;
};
const element = SelectorFind.first('meta[name="viewport"]').getOrThunk(nu);
const backup = Attr.get(element, 'content');
const maximize = function () {
Attr.set(element, 'content', 'width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0');
};
const restore = function () {
if (backup !== undefined && backup !== null && backup.length > 0) {
Attr.set(element, 'content', backup);
} else {
// According to apple docs the default is:
// width=980
// height=<calculated>
// initial-scale=<calculated>
// minimum-scale=0.25
// maximum-scale=5.0
// user-scalable yes
// However just setting user-scalable seems to fix pinch zoom and who knows these defaults might change
Attr.set(element, 'content', 'user-scalable=yes');
}
};
return {
maximize,
restore
};
};
示例2: function
export default function () {
const ephoxUi = SelectorFind.first('#ephox-ui').getOrDie();
const fontSlider = Container.sketch({
dom: UiDomFactory.dom('<div class="${prefix}-toolbar ${prefix}-context-toolbar"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-toolbar-group"></div>'),
components: FontSizeSlider.makeItems({
onChange: Fun.noop,
getInitialValue: Fun.constant(2)
})
}
]
});
const colorSlider = Container.sketch({
dom: UiDomFactory.dom('<div class="${prefix}-toolbar ${prefix}-context-toolbar"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-toolbar-group"></div>'),
components: ColorSlider.makeItems({
onChange: Fun.noop,
getInitialValue: Fun.constant(-1)
})
}
]
});
const gui = Gui.create();
Attachment.attachSystem(ephoxUi, gui);
const container = GuiFactory.build({
dom: UiDomFactory.dom('<div class="{prefix}-outer-container ${prefix}-fullscreen-maximized"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-toolstrip"></div>'),
components: [ fontSlider ]
},
{
dom: UiDomFactory.dom('<div class="${prefix}-toolstrip"></div>'),
components: [ colorSlider ]
}
]
});
gui.add(container);
}
示例3: function
export default function () {
const ephoxUi = SelectorFind.first('#ephox-ui').getOrDie();
const form = SerialisedDialog.sketch({
onExecute () { },
getInitialValue () {
return Option.some({
alpha: 'Alpha',
beta: '',
gamma: '',
delta: ''
});
},
fields: [
Inputs.field('alpha', 'placeholder-alpha'),
Inputs.field('beta', 'placeholder-beta'),
Inputs.field('gamma', 'placeholder-gamma'),
Inputs.field('delta', 'placeholder-delta')
]
});
const gui = Gui.create();
Attachment.attachSystem(ephoxUi, gui);
const container = GuiFactory.build({
dom: UiDomFactory.dom('<div class="${prefix}-outer-container ${prefix}-fullscreen-maximized"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-toolstrip"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-toolbar ${prefix}-context-toolbar"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-toolbar-group"></div>'),
components: [
form
]
}
]
}
]
}
]
});
gui.add(container);
}
示例4: function
export default function () {
const ephoxUi = SelectorFind.first('#ephox-ui').getOrDie();
const menu = StylesMenu.sketch({
formats: {
menus: {
Beta: [
{ title: 'Beta-1', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Beta-2', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Beta-3', isSelected: Fun.constant(false), getPreview: Fun.constant('') }
]
},
expansions: {
Beta: 'Beta'
},
items: [
{ title: 'Alpha', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Beta', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Gamma', isSelected: Fun.constant(true), getPreview: Fun.constant('') }
]
},
handle (format) {
// tslint:disable-next-line:no-console
console.log('firing', format);
}
});
const gui = Gui.create();
Attachment.attachSystem(ephoxUi, gui);
const container = GuiFactory.build({
dom: UiDomFactory.dom('<div class="${prefix}-outer-container ${prefix}-fullscreen-maximized"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-dropup" style="height: 500px;"></div>'),
components: [
menu
]
}
]
});
gui.add(container);
}