Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit c5c0330

Browse files
sebgeelendmo-odoo
authored andcommitted
[FIX] Inline : Better calculation of current modifier
In case of empty cache, the current modifier sometimes are wrong when placed at the start of a line
1 parent 6954856 commit c5c0330

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/plugin-inline/src/Inline.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Constructor } from '../../utils/src/utils';
88
import { VNode } from '../../core/src/VNodes/VNode';
99
import { Modifiers } from '../../core/src/Modifiers';
1010
import { CssStyle } from '../../plugin-xml/src/CssStyle';
11+
import { LineBreakNode } from '../../plugin-linebreak/src/LineBreakNode';
1112
import { Loadables } from '../../core/src/JWEditor';
1213
import { Renderer } from '../../plugin-renderer/src/Renderer';
1314
import { InlineFormatDomObjectRenderer } from './InlineFormatDomObjectRenderer';
@@ -147,7 +148,10 @@ export class Inline<T extends JWPluginConfig = JWPluginConfig> extends JWPlugin<
147148

148149
let inlineToCopyModifiers: VNode;
149150
if (range.isCollapsed()) {
150-
inlineToCopyModifiers = range.start.previousSibling() || range.start.nextSibling();
151+
// TODO: LineBreakNode should have the formats as well.
152+
inlineToCopyModifiers =
153+
range.start.previousSibling(node => !node.test(LineBreakNode)) ||
154+
range.start.nextSibling();
151155
} else {
152156
inlineToCopyModifiers = range.start.nextSibling();
153157
}

0 commit comments

Comments
 (0)