本文整理汇总了TypeScript中tinymce/core/api/util/I18n.isRtl函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isRtl函数的具体用法?TypeScript isRtl怎么用?TypeScript isRtl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isRtl函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: renderColorStructure
const renderItemStructure = <T>(info: ItemStructureSpec, providersBackstage: UiFactoryBackstageProviders, renderIcons: boolean, fallbackIcon: Option<string> = Option.none()): { dom: RawDomSchema, optComponents: Array<Option<AlloySpec>> } => {
// If RTL and icon is in whitelist, add RTL icon class for icons that don't have a `-rtl` icon available.
// Use `-rtl` icon suffix for icons that do.
const getIconName = (iconName: Option<string>): Option<string> => {
return iconName.map((name) => I18n.isRtl() && Arr.contains(rtlIcon, name) ? name + '-rtl' : name);
};
const needRtlClass = I18n.isRtl() && info.iconContent.exists((name) => Arr.contains(rtlTransform, name));
// TODO: TINY-3036 Work out a better way of dealing with custom icons
const icon = getIconName(info.iconContent).map((iconName) => Icons.getOr(iconName, providersBackstage.icons, fallbackIcon));
// Style items and autocompleter both have meta. Need to branch on style
// This could probably be more stable...
const textRender: (text: string) => AlloySpec = Option.from(info.meta).fold(
() => renderText,
(meta) => {
return Obj.has(meta, 'style') ? Fun.curry(renderStyledText, meta.style) : renderText;
}
);
if (info.presets === 'color') {
return renderColorStructure(info.ariaLabel, info.value, icon, providersBackstage);
} else {
return renderNormalItemStructure(info, icon, renderIcons, textRender, needRtlClass);
}
};
开发者ID:tinymce,项目名称:tinymce,代码行数:27,代码来源:ItemStructure.ts
示例2: componentRenderPipeline
const renderCommonStructure = (icon: Option<string>, text: Option<string>, tooltip: Option<string>, receiver: Option<string>, behaviours: Option<Behaviour.NamedConfiguredBehaviour<Behaviour.BehaviourConfigSpec, Behaviour.BehaviourConfigDetail>[]>, providersBackstage: UiFactoryBackstageProviders) => {
// If RTL and icon is in whitelist, add RTL icon class for icons that don't have a `-rtl` icon available.
// Use `-rtl` icon suffix for icons that do.
const getIconName = (iconName: string): string => {
return I18n.isRtl() && Arr.contains(rtlIcon, iconName) ? iconName + '-rtl' : iconName;
};
const needsRtlClass = I18n.isRtl() && icon.exists((name) => Arr.contains(rtlTransform, name));
return {
dom: {
tag: 'button',
classes: [ ToolbarButtonClasses.Button ].concat(text.isSome() ? [ ToolbarButtonClasses.MatchWidth ] : []).concat(needsRtlClass ? [ ToolbarButtonClasses.IconRtl ] : []),
attributes: getTooltipAttributes(tooltip, providersBackstage)
},
components: componentRenderPipeline([
icon.map((iconName) => renderIconFromPack(getIconName(iconName), providersBackstage.icons)),
text.map((text) => renderLabel(text, ToolbarButtonClasses.Button, providersBackstage))
]),
eventOrder: {
[NativeEvents.mousedown()]: [
'focusing',
'alloy.base.behaviour',
'common-button-display-events'
]
},
buttonBehaviours: Behaviour.derive(
[
AddEventsBehaviour.config('common-button-display-events', [
AlloyEvents.run(NativeEvents.mousedown(), (button, se) => {
se.event().prevent();
AlloyTriggers.emit(button, focusButtonEvent);
})
])
].concat(
receiver.map((r) => {
return Reflecting.config({
channel: r,
initialData: { icon, text },
renderComponents: (data, _state) => {
return componentRenderPipeline([
data.icon.map((iconName) => renderIconFromPack(getIconName(iconName), providersBackstage.icons)),
data.text.map((text) => renderLabel(text, ToolbarButtonClasses.Button, providersBackstage))
]);
}
});
}).toArray()
).concat(behaviours.getOr([ ]))
)
};
};
开发者ID:tinymce,项目名称:tinymce,代码行数:54,代码来源:ToolbarButtons.ts
示例3: function
suite.test('Switch language', function () {
I18n.add('code1', {
text: 'translation1'
});
RawAssertions.assertEq('Should not have switched language code', 'en', I18n.getCode());
RawAssertions.assertEq('Should not be in in rtl mode', false, I18n.isRtl());
RawAssertions.assertEq('Should not get code1 translation', 'text', I18n.translate('text'));
I18n.add('code2', {
_dir: 'rtl',
text: 'translation2'
});
I18n.setCode('code2');
RawAssertions.assertEq('Should have switched language code', 'code2', I18n.getCode());
RawAssertions.assertEq('Should be in in rtl mode', true, I18n.isRtl());
RawAssertions.assertEq('Should be get code2 translation', 'translation2', I18n.translate('text'));
I18n.setCode('en');
});
开发者ID:tinymce,项目名称:tinymce,代码行数:21,代码来源:I18nTest.ts
示例4:
return iconName.map((name) => I18n.isRtl() && Arr.contains(rtlIcon, name) ? name + '-rtl' : name);
开发者ID:tinymce,项目名称:tinymce,代码行数:1,代码来源:ItemStructure.ts
示例5: onEscape
const setup = (editor: Editor): RenderInfo => {
const isInline = editor.getParam('inline', false, 'boolean');
const mode = isInline ? Inline : Iframe;
let lazyOuterContainer: Option<AlloyComponent> = Option.none();
const dirAttributes = I18n.isRtl() ? {
attributes: {
dir: 'rtl'
}
} : {};
const sink = GuiFactory.build({
dom: {
tag: 'div',
classes: ['tox', 'tox-silver-sink', 'tox-tinymce-aux'],
...dirAttributes
},
behaviours: Behaviour.derive([
Positioning.config({
useFixed: false // this allows menus to scroll with the outer page, we don't want position: fixed
})
])
});
const memAnchorBar = Memento.record({
dom: {
tag: 'div',
classes: [ 'tox-anchorbar']
}
});
const lazyAnchorBar = () => lazyOuterContainer.bind((container) => {
return memAnchorBar.getOpt(container);
}).getOrDie('Could not find a anchor bar element');
const lazyMoreButton = () => lazyOuterContainer.bind((container) => {
return OuterContainer.getMoreButton(container);
}).getOrDie('Could not find more button element');
const lazyToolbar = () => lazyOuterContainer.bind((container) => {
return OuterContainer.getToolbar(container);
}).getOrDie('Could not find more toolbar element');
const lazyThrobber = () => lazyOuterContainer.bind((container) => {
return OuterContainer.getThrobber(container);
}).getOrDie('Could not find throbber element');
const backstage: Backstage.UiFactoryBackstage = Backstage.init(sink, editor, lazyAnchorBar, lazyMoreButton);
const lazySink = () => Result.value<AlloyComponent, Error>(sink);
const partMenubar: AlloySpec = OuterContainer.parts().menubar({
dom: {
tag: 'div',
classes: [ 'tox-menubar' ]
},
backstage,
onEscape () {
editor.focus();
}
});
const partToolbar: AlloySpec = OuterContainer.parts().toolbar({
dom: {
tag: 'div',
classes: [ 'tox-toolbar' ]
},
getSink: lazySink,
backstage,
onEscape() {
editor.focus();
},
split: getToolbarDrawer(editor),
lazyToolbar,
lazyMoreButton
});
const partSocket: AlloySpec = OuterContainer.parts().socket({
dom: {
tag: 'div',
classes: [ 'tox-edit-area' ]
}
});
const partSidebar: AlloySpec = OuterContainer.parts().sidebar({
dom: {
tag: 'div',
classes: ['tox-sidebar']
}
});
const partThrobber: AlloySpec = OuterContainer.parts().throbber({
dom: {
tag: 'div',
classes: ['tox-throbber']
},
backstage
});
const statusbar = editor.getParam('statusbar', true, 'boolean') && !isInline ? Option.some(renderStatusbar(editor, backstage.shared.providers)) : Option.none();
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:Render.ts
示例6:
const sAssertRtl = (label: string, rtl: boolean) => Step.sync(() => {
RawAssertions.assertEq(label, rtl, I18n.isRtl());
});
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:EditorRtlTest.ts
示例7:
const getIconName = (iconName: string): string => {
return I18n.isRtl() && Arr.contains(rtlIcon, iconName) ? iconName + '-rtl' : iconName;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:ToolbarButtons.ts
示例8: function
//.........这里部分代码省略.........
label: 'Replace with'
},
{
type: 'grid',
columns: 2,
items: [
{
type: 'checkbox',
name: 'matchcase',
label: 'Match case'
},
{
type: 'checkbox',
name: 'wholewords',
label: 'Find whole words only'
}
]
}
]
},
buttons: [
{
type: 'custom',
name: 'find',
text: 'Find',
align: 'start',
primary: true
},
{
type: 'custom',
name: 'replace',
text: 'Replace',
align: 'start',
disabled: true,
},
{
type: 'custom',
name: 'replaceall',
text: 'Replace All',
align: 'start',
disabled: true,
},
{
type: 'custom',
name: 'prev',
text: 'Previous',
align: 'end',
// TODO TINY-3598: Use css to transform the icons when dir=rtl instead of swapping them
icon: I18n.isRtl() ? 'arrow-right' : 'arrow-left',
disabled: true,
},
{
type: 'custom',
name: 'next',
text: 'Next',
align: 'end',
// TODO TINY-3598: Use css to transform the icons when dir=rtl instead of swapping them
icon: I18n.isRtl() ? 'arrow-left' : 'arrow-right',
disabled: true,
}
],
initialData,
onAction: (api, details) => {
const data = api.getData();
switch (details.name) {
case 'find':
doSubmit(api);
break;
case 'replace':
if (!Actions.replace(editor, currentIndexState, data.replacetext)) {
disableAll(api, true);
currentIndexState.set(-1);
last = {};
}
break;
case 'replaceall':
Actions.replace(editor, currentIndexState, data.replacetext, true, true);
disableAll(api, true);
last = {};
break;
case 'prev':
Actions.prev(editor, currentIndexState);
updateButtonStates(api);
break;
case 'next':
Actions.next(editor, currentIndexState);
updateButtonStates(api);
break;
default:
break;
}
},
onSubmit: doSubmit,
onClose: () => {
editor.focus();
Actions.done(editor, currentIndexState);
editor.undoManager.add();
}
});
};
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:Dialog.ts
注:本文中的tinymce/core/api/util/I18n.isRtl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论