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:
parent
d84f5072c1
commit
dda0628c04
@ -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
|
||||
|
@ -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'))
|
Loading…
x
Reference in New Issue
Block a user