diff --git a/packages/roosterjs-editor-dom/lib/index.ts b/packages/roosterjs-editor-dom/lib/index.ts index 19fb99a8eec..1e054e8a329 100644 --- a/packages/roosterjs-editor-dom/lib/index.ts +++ b/packages/roosterjs-editor-dom/lib/index.ts @@ -29,7 +29,6 @@ export { export { default as getTagOfNode } from './utils/getTagOfNode'; export { default as isBlockElement } from './utils/isBlockElement'; export { default as isNodeEmpty } from './utils/isNodeEmpty'; -export { default as isRtl } from './utils/isRtl'; export { default as isVoidHtmlElement } from './utils/isVoidHtmlElement'; export { default as matchLink } from './utils/matchLink'; export { default as adjustNodeInsertPosition } from './utils/adjustNodeInsertPosition'; diff --git a/packages/roosterjs-editor-dom/lib/utils/isRtl.ts b/packages/roosterjs-editor-dom/lib/utils/isRtl.ts deleted file mode 100644 index 5807bb11607..00000000000 --- a/packages/roosterjs-editor-dom/lib/utils/isRtl.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { getComputedStyle } from './getComputedStyles'; - -/** - * Check if the given element is using right-to-left layout - * @param element An HTML element to check - * @returns True if the given element is using right-to-left layout, otherwise false - */ -export default function isRtl(element: HTMLElement): boolean { - return getComputedStyle(element, 'direction') == 'rtl'; -} diff --git a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/cursorFeatures.ts b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/cursorFeatures.ts index 0b9052362b3..fa3c835236a 100644 --- a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/cursorFeatures.ts +++ b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/cursorFeatures.ts @@ -1,4 +1,4 @@ -import { Browser, isRtl, Position } from 'roosterjs-editor-dom'; +import { Browser, getComputedStyle, Position } from 'roosterjs-editor-dom'; import { ContentEditFeature, CursorFeatureSettings, Keys } from 'roosterjs-editor-types'; const NoCycleCursorMove: ContentEditFeature = { @@ -18,7 +18,7 @@ const NoCycleCursorMove: ContentEditFeature = { return false; } - let rtl = isRtl(position.element); + let rtl = getComputedStyle(position.element, 'direction') == 'rtl'; let rawEvent = event.rawEvent; return (!rtl && rawEvent.which == Keys.LEFT) || (rtl && rawEvent.which == Keys.RIGHT);