本文整理汇总了TypeScript中@ephox/sugar.Css.getRaw方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Css.getRaw方法的具体用法?TypeScript Css.getRaw怎么用?TypeScript Css.getRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.Css
的用法示例。
在下文中一共展示了Css.getRaw方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const extractAdvancedStyles = (dom, elm) => {
const rgbToHex = (value: string) => Strings.startsWith(value, 'rgb') ? dom.toHex(value) : value;
const borderStyle = Css.getRaw(Element.fromDom(elm), 'border-style').getOr('');
const borderColor = Css.getRaw(Element.fromDom(elm), 'border-color').map(rgbToHex).getOr('');
const bgColor = Css.getRaw(Element.fromDom(elm), 'background-color').map(rgbToHex).getOr('');
return {
borderstyle: borderStyle,
bordercolor: borderColor,
backgroundcolor: bgColor
};
};
示例2: function
const updateScrollingFixed = function (element, winY, offsetY) {
const destTop = winY + offsetY;
const oldProp = Css.getRaw(element, 'top').getOr(offsetY);
// While we are changing top, aim to scroll by the same amount to keep the cursor in the same location.
const delta = destTop - parseInt(oldProp, 10);
const destScroll = element.dom().scrollTop + delta;
return IosScrolling.moveScrollAndTop(element, destScroll, destTop);
};
示例3: parseInt
SelectorFind.descendant(dialog.element(), '.' + Styles.resolve('serialised-dialog-chain')).each(function (parent) {
if ((spec.state.currentScreen.get() + direction) >= 0 && (spec.state.currentScreen.get() + direction) < screens.length) {
Css.getRaw(parent, 'left').each(function (left) {
const currentLeft = parseInt(left, 10);
const w = Width.get(screens[0]);
Css.set(parent, 'left', (currentLeft - (direction * w)) + 'px');
});
spec.state.currentScreen.set(spec.state.currentScreen.get() + direction);
}
});
示例4:
validate: (input) => {
const inputValue = Representing.getValue(input);
// Consider empty strings valid colours
if (inputValue.length === 0) {
return Future.pure(Result.value(true));
} else {
const span = Element.fromTag('span');
Css.set(span, 'background-color', inputValue);
const res = Css.getRaw(span, 'background-color').fold(
// TODO: Work out what we want to do here.
() => Result.error('blah'),
(_) => Result.value(inputValue)
);
return Future.pure(res);
}
}
示例5: parseInt
SelectorFind.descendant(comp.element(), '[role="tabpanel"]').each((tabview) => {
const oldFocus = Focus.active();
Css.set(tabview, 'visibility', 'hidden');
const oldHeight = Css.getRaw(tabview, 'height').map((h) => parseInt(h, 10));
Css.remove(tabview, 'height');
const newHeight = tabview.dom().getBoundingClientRect().height;
const hasGrown = oldHeight.forall((h) => newHeight > h);
if (hasGrown) {
maxTabHeight.set(Option.from(newHeight));
updateTabviewHeight(comp.element(), tabview, maxTabHeight);
} else {
oldHeight.each((h) => {
Css.set(tabview, 'height', `${h}px`);
});
}
Css.remove(tabview, 'visibility');
oldFocus.each(Focus.focus);
});
示例6:
const getProperty = (elm) => Css.getRaw(elm, propName);
示例7: function
const getTop = function (element) {
const raw = Css.getRaw(element, 'top').getOr(0);
return parseInt(raw, 10);
};
示例8:
onStartGrow: (slider: AlloyComponent) => {
AlloyTriggers.emitWith(slider, fixSize, { width: Css.getRaw(slider.element(), 'width').getOr('') });
},
示例9: isScrolling
PlatformEditor.getActiveApi(platform.editor).each(function (editorApi) {
// TODO: Orientation changes.
// orientation = Orientation.onChange();
priorState.set({
socketHeight: Css.getRaw(platform.socket, 'height'),
iframeHeight: Css.getRaw(editorApi.frame(), 'height'),
outerScroll: document.body.scrollTop
});
scrollEvents.set({
// Allow only things that have scrollable class to be scrollable. Without this,
// the toolbar scrolling gets prevented
exclusives: Scrollables.exclusive(doc, '.' + Scrollable.scrollable())
});
Class.add(platform.container, Styles.resolve('fullscreen-maximized'));
Thor.clobberStyles(platform.container, editorApi.body());
meta.maximize();
/* NOTE: Making the toolbar scrollable is now done when the middle group is created */
Css.set(platform.socket, 'overflow', 'scroll');
Css.set(platform.socket, '-webkit-overflow-scrolling', 'touch');
Focus.focus(editorApi.body());
const setupBag = Struct.immutableBag([
'cWin',
'ceBody',
'socket',
'toolstrip',
'toolbar',
'dropup',
'contentElement',
'cursor',
'keyboardType',
'isScrolling',
'outerWindow',
'outerBody'
], []);
iosApi.set(
IosSetup.setup(setupBag({
cWin: editorApi.win(),
ceBody: editorApi.body(),
socket: platform.socket,
toolstrip: platform.toolstrip,
toolbar: platform.toolbar,
dropup: platform.dropup.element(),
contentElement: editorApi.frame(),
cursor: Fun.noop,
outerBody: platform.body,
outerWindow: platform.win,
keyboardType: IosKeyboard.stubborn,
isScrolling () {
return scrollEvents.get().exists(function (s) {
return s.socket.isScrolling();
});
}
}))
);
iosApi.run(function (api) {
api.syncHeight();
});
iosEvents.set(
IosEvents.initEvents(editorApi, iosApi, platform.toolstrip, platform.socket, platform.dropup)
);
});