tiptap: update input rule

This commit is contained in:
fantasticit 2022-08-19 18:40:54 +08:00
parent 3bd5d1180c
commit 32fdf58f42
8 changed files with 8 additions and 8 deletions

View File

@ -69,7 +69,7 @@ export const Callout = Node.create({
addInputRules() { addInputRules() {
return [ return [
wrappingInputRule({ wrappingInputRule({
find: /^\$callout $/, find: /^\$callout\$$/,
type: this.type, type: this.type,
getAttributes: (match) => { getAttributes: (match) => {
return { type: match[1] }; return { type: match[1] };

View File

@ -268,7 +268,7 @@ export const Columns = Node.create({
addInputRules() { addInputRules() {
return [ return [
nodeInputRule({ nodeInputRule({
find: /^\$columns $/, find: /^\$columns\$$/,
type: this.type, type: this.type,
getAttributes: () => { getAttributes: () => {
return { type: 'left-right', columns: 2 }; return { type: 'left-right', columns: 2 };

View File

@ -78,7 +78,7 @@ export const Countdown = Node.create({
addInputRules() { addInputRules() {
return [ return [
nodeInputRule({ nodeInputRule({
find: /^\$countdown $/, find: /^\$countdown\$$/,
type: this.type, type: this.type,
getAttributes: () => { getAttributes: () => {
return { width: '100%' }; return { width: '100%' };

View File

@ -103,7 +103,7 @@ export const Excalidraw = Node.create({
addInputRules() { addInputRules() {
return [ return [
nodeInputRule({ nodeInputRule({
find: /^\$excalidraw $/, find: /^\$excalidraw\$$/,
type: this.type, type: this.type,
getAttributes: () => { getAttributes: () => {
return { width: '100%' }; return { width: '100%' };

View File

@ -108,7 +108,7 @@ export const Flow = Node.create<IFlowOptions>({
addInputRules() { addInputRules() {
return [ return [
nodeInputRule({ nodeInputRule({
find: /^\$flow $/, find: /^\$flow\$$/,
type: this.type, type: this.type,
getAttributes: () => { getAttributes: () => {
return { width: '100%', defaultShowPicker: true, createUser: this.options.getCreateUserId() }; return { width: '100%', defaultShowPicker: true, createUser: this.options.getCreateUserId() };

View File

@ -98,7 +98,7 @@ export const Iframe = Node.create({
addInputRules() { addInputRules() {
return [ return [
nodeInputRule({ nodeInputRule({
find: /^\$iframe $/, find: /^\$iframe\$$/,
type: this.type, type: this.type,
getAttributes: () => { getAttributes: () => {
return { width: '100%' }; return { width: '100%' };

View File

@ -78,7 +78,7 @@ export const Katex = Node.create<IKatexOptions>({
addInputRules() { addInputRules() {
return [ return [
nodeInputRule({ nodeInputRule({
find: /^\$katex $/, find: /^\$katex\$$/,
type: this.type, type: this.type,
getAttributes: () => { getAttributes: () => {
return { defaultShowPicker: true, createUser: this.options.getCreateUserId() }; return { defaultShowPicker: true, createUser: this.options.getCreateUserId() };

View File

@ -83,7 +83,7 @@ const placeholders = [
'使用 markdown 语法进行输入', '使用 markdown 语法进行输入',
'输入 @ 来提及他人', '输入 @ 来提及他人',
'输入 : 来插入表情', '输入 : 来插入表情',
'你知道吗?输入 $katex 然后按一下空格就可以快速插入数学公式,其他节点操作类似哦', '你知道吗?输入 $katex 然后在输入一个 $ 就可以快速插入数学公式,其他节点操作类似哦',
]; ];
const getCreateUserId = () => safeJSONParse(window.localStorage.getItem('user')).id; const getCreateUserId = () => safeJSONParse(window.localStorage.getItem('user')).id;