mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 14:11:35 +02:00
fix: ts (#3270)
* fix: ts Fix: - Argument of type 'Point | undefined' is not assignable to parameter of type 'Location'. Type 'undefined' is not assignable to type 'Location'. - Types of property 'zIndex' are incompatible. * use && * use optional chaining * revert optional chaining (not supported)
This commit is contained in:
committed by
Ian Storm Taylor
parent
043a5c1709
commit
3b16a1c3f0
@@ -83,10 +83,10 @@ const MentionExample = () => {
|
|||||||
if (selection && Range.isCollapsed(selection)) {
|
if (selection && Range.isCollapsed(selection)) {
|
||||||
const [start] = Range.edges(selection)
|
const [start] = Range.edges(selection)
|
||||||
const wordBefore = Editor.before(editor, start, { unit: 'word' })
|
const wordBefore = Editor.before(editor, start, { unit: 'word' })
|
||||||
const before = Editor.before(editor, wordBefore)
|
const before = wordBefore && Editor.before(editor, wordBefore)
|
||||||
const beforeRange = Editor.range(editor, before, start)
|
const beforeRange = before && Editor.range(editor, before, start)
|
||||||
const beforeText = Editor.text(editor, beforeRange)
|
const beforeText = beforeRange && Editor.text(editor, beforeRange)
|
||||||
const beforeMatch = beforeText.match(/^@(\w+)$/)
|
const beforeMatch = beforeText && beforeText.match(/^@(\w+)$/)
|
||||||
const after = Editor.after(editor, start)
|
const after = Editor.after(editor, start)
|
||||||
const afterRange = Editor.range(editor, start, after)
|
const afterRange = Editor.range(editor, start, after)
|
||||||
const afterText = Editor.text(editor, afterRange)
|
const afterText = Editor.text(editor, afterRange)
|
||||||
@@ -116,7 +116,7 @@ const MentionExample = () => {
|
|||||||
top: '-9999px',
|
top: '-9999px',
|
||||||
left: '-9999px',
|
left: '-9999px',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
zIndex: '1',
|
zIndex: 1,
|
||||||
padding: '3px',
|
padding: '3px',
|
||||||
background: 'white',
|
background: 'white',
|
||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
|
Reference in New Issue
Block a user