1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-01 05:16:10 +01:00

fix activeMarks for intersecting marks text (#2226)

This commit is contained in:
Dmitry Zarva 2018-10-04 19:14:34 +03:00 committed by Ian Storm Taylor
parent d84f5072c1
commit dda0628c04
2 changed files with 26 additions and 1 deletions

View File

@ -307,7 +307,7 @@ class Text extends Record(DEFAULTS) {
const result = this.leaves.first().marks
if (result.size === 0) return result
return result.withMutations(x => {
return result.toOrderedSet().withMutations(x => {
this.leaves.forEach(c => {
x.intersect(c.marks)
if (x.size === 0) return false

View File

@ -0,0 +1,25 @@
/** @jsx h */
import h from '../../../../helpers/h'
import { Set } from 'immutable'
import Mark from '../../../../../src/models/mark'
export const input = (
<text>
<u>
<i>
<b>b</b>
</i>
</u>
<u>
<i>u</i>
</u>
<i>g</i>
</text>
)[0]
export default function(t) {
return t.getActiveMarks()
}
export const output = Set.of(Mark.create('italic'))