feat: Link feature add search function

This commit is contained in:
xiaodong zuo
2022-09-01 10:44:21 +08:00
parent 73d6e34c5d
commit e18a35989f
9 changed files with 367 additions and 2 deletions
@@ -5,6 +5,7 @@ import type {
} from '@toeverything/components/common';
import {
BaseRange,
Location,
Node,
Path,
Point,
@@ -41,7 +42,8 @@ type TextUtilsFunctions =
| 'blur'
| 'setSelection'
| 'insertNodes'
| 'getNodeByPath';
| 'getNodeByPath'
| 'wrapLink';
type ExtendedTextUtils = SlateUtils & {
setLinkModalVisible: (visible: boolean) => void;
@@ -412,4 +414,13 @@ export class BlockHelper {
console.warn('Could find the block text utils');
return undefined;
}
public wrapLink(blockId: string, url: string, preSelection?: Location) {
const text_utils = this._blockTextUtilsMap[blockId];
if (text_utils) {
return text_utils.wrapLink(url, preSelection);
}
console.warn('Could find the block text utils');
return undefined;
}
}