tiptap: update input rule

fix/tiptap
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() {
return [
wrappingInputRule({
find: /^\$callout $/,
find: /^\$callout\$$/,
type: this.type,
getAttributes: (match) => {
return { type: match[1] };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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