diff --git a/console/src/editor/chirpy/ChirpyPromptComponent.vue b/console/src/editor/chirpy/ChirpyPromptComponent.vue index 8ef5d00..1153284 100644 --- a/console/src/editor/chirpy/ChirpyPromptComponent.vue +++ b/console/src/editor/chirpy/ChirpyPromptComponent.vue @@ -2,15 +2,16 @@ import { nodeViewProps, NodeViewWrapper } from "@halo-dev/richtext-editor"; const props = defineProps(nodeViewProps); -console.log("props", props) - +const updateInput = (e: any) => { + props.updateAttributes({ content: e.target.value }); +}; @@ -42,7 +41,7 @@ console.log("props", props) background-color: rgb(248, 215, 218, 0.56); } -.chirpy-prompt-node-view{ +.chirpy-prompt-node-view { margin: .75em 10px 10px; } @@ -55,5 +54,11 @@ console.log("props", props) .prompt-text { margin: 5px 10px; + padding: 10px; + border: 1px solid #ccc; + border-radius: 4px; + font-size: 14px; + width: calc(100% - 30px); + box-sizing: border-box; } diff --git a/console/src/editor/chirpy/index.ts b/console/src/editor/chirpy/index.ts index 6f12405..91bda44 100644 --- a/console/src/editor/chirpy/index.ts +++ b/console/src/editor/chirpy/index.ts @@ -43,7 +43,10 @@ export const ChirpyPrompt = Node.create({ return { type: { default: 'tip', - } + }, + content: { + default: "", + }, } }, @@ -58,7 +61,10 @@ export const ChirpyPrompt = Node.create({ renderHTML({node, HTMLAttributes}) { const hasType = this.options.types.includes(node.attrs.type) const type = hasType ? node.attrs.type : this.options.types[0] - return ['chirpy-prompt', mergeAttributes(HTMLAttributes, {class: `prompt-${type}`,}), 0] + return ['chirpy-prompt', + mergeAttributes(HTMLAttributes, {class: `prompt-${type}`,}), + `${HTMLAttributes.content}`, + ] }, addNodeView() {