1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 05:31:56 +02:00
* 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:
Ziad Beyens
2019-12-07 21:31:51 +01:00
committed by Ian Storm Taylor
parent 043a5c1709
commit 3b16a1c3f0

View File

@@ -83,10 +83,10 @@ const MentionExample = () => {
if (selection && Range.isCollapsed(selection)) {
const [start] = Range.edges(selection)
const wordBefore = Editor.before(editor, start, { unit: 'word' })
const before = Editor.before(editor, wordBefore)
const beforeRange = Editor.range(editor, before, start)
const beforeText = Editor.text(editor, beforeRange)
const beforeMatch = beforeText.match(/^@(\w+)$/)
const before = wordBefore && Editor.before(editor, wordBefore)
const beforeRange = before && Editor.range(editor, before, start)
const beforeText = beforeRange && Editor.text(editor, beforeRange)
const beforeMatch = beforeText && beforeText.match(/^@(\w+)$/)
const after = Editor.after(editor, start)
const afterRange = Editor.range(editor, start, after)
const afterText = Editor.text(editor, afterRange)
@@ -116,7 +116,7 @@ const MentionExample = () => {
top: '-9999px',
left: '-9999px',
position: 'absolute',
zIndex: '1',
zIndex: 1,
padding: '3px',
background: 'white',
borderRadius: '4px',