mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 10:51:44 +02:00
fix activeMarks for intersecting marks text (#2226)
This commit is contained in:
committed by
Ian Storm Taylor
parent
d84f5072c1
commit
dda0628c04
@@ -307,7 +307,7 @@ class Text extends Record(DEFAULTS) {
|
|||||||
const result = this.leaves.first().marks
|
const result = this.leaves.first().marks
|
||||||
if (result.size === 0) return result
|
if (result.size === 0) return result
|
||||||
|
|
||||||
return result.withMutations(x => {
|
return result.toOrderedSet().withMutations(x => {
|
||||||
this.leaves.forEach(c => {
|
this.leaves.forEach(c => {
|
||||||
x.intersect(c.marks)
|
x.intersect(c.marks)
|
||||||
if (x.size === 0) return false
|
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'))
|
Reference in New Issue
Block a user