@threenine/nuxstr-comments 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@threenine/nuxstr-comments",
3
3
  "configKey": "nuxstrComments",
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -2,6 +2,7 @@
2
2
  import { ref, onMounted } from "vue";
3
3
  import { useNuxstr } from "../composables/useNuxstr";
4
4
  import { useNuxstrComments } from "../composables/useNuxstrComments";
5
+ import { marked } from "marked";
5
6
  const props = defineProps({
6
7
  contentId: { type: String, required: false }
7
8
  });
@@ -16,21 +17,6 @@ async function handlePost() {
16
17
  const ok = await postComment(comment.value);
17
18
  if (ok) comment.value = "";
18
19
  }
19
- function parseContent(html) {
20
- return { body: createRoot(html) };
21
- }
22
- function createRoot(html) {
23
- return {
24
- type: "root",
25
- children: [
26
- {
27
- type: "element",
28
- tag: "div",
29
- props: { innerHTML: html }
30
- }
31
- ]
32
- };
33
- }
34
20
  </script>
35
21
 
36
22
  <template>
@@ -85,30 +71,32 @@ function createRoot(html) {
85
71
  </div>
86
72
  </div>
87
73
  <div class="prose prose-sm prose-invert mt-2">
88
- <ContentRenderer :value="parseContent(c.content)" />
74
+ <!-- eslint-disable-next-line vue/no-v-html -->
75
+ <div v-html="marked.parse(c.content)" />
76
+ <!-- eslint-disable-next-line vue/no-v-html -->
89
77
  </div>
90
78
  </div>
91
- </div>
92
79
 
93
- <div
94
- v-if="isLoggedIn"
95
- class="space-y-2"
96
- >
97
- <UTextarea
98
- v-model="comment"
99
- class="w-full"
100
- placeholder="Write a comment ...."
101
- :rows="4"
102
- />
103
- <div class="flex justify-end">
104
- <UButton
105
- color="primary"
106
- variant="solid"
107
- :disabled="!comment.trim()"
108
- @click="handlePost"
109
- >
110
- Post Comment
111
- </UButton>
80
+ <div
81
+ v-if="isLoggedIn"
82
+ class="space-y-2"
83
+ >
84
+ <UTextarea
85
+ v-model="comment"
86
+ class="w-full"
87
+ placeholder="Write a comment ...."
88
+ :rows="4"
89
+ />
90
+ <div class="flex justify-end">
91
+ <UButton
92
+ color="primary"
93
+ variant="solid"
94
+ :disabled="!comment.trim()"
95
+ @click="handlePost"
96
+ >
97
+ Post Comment
98
+ </UButton>
99
+ </div>
112
100
  </div>
113
101
  </div>
114
102
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threenine/nuxstr-comments",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Nuxstr Comments",
5
5
  "repository": "threenine/nuxstr-comments",
6
6
  "license": "MIT",
@@ -22,25 +22,15 @@
22
22
  "files": [
23
23
  "dist"
24
24
  ],
25
- "scripts": {
26
- "prepack": "nuxt-module-build build",
27
- "dev": "npm run dev:prepare && nuxi dev playground",
28
- "dev:build": "nuxi build playground",
29
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
30
- "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
31
- "lint": "eslint .",
32
- "test": "vitest run",
33
- "test:watch": "vitest watch",
34
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
35
- },
36
25
  "dependencies": {
37
26
  "@nostr-dev-kit/ndk": "^2.14.33",
38
27
  "@nuxt/kit": "^4.0.3",
39
- "nostr-tools": "^2.16.2",
40
- "defu": "^6.1.4"
28
+ "defu": "^6.1.4",
29
+ "dompurify": "^3.2.6",
30
+ "marked": "^16.2.1",
31
+ "nostr-tools": "^2.16.2"
41
32
  },
42
33
  "devDependencies": {
43
- "@nuxt/content": "3.6.3",
44
34
  "@nuxt/devtools": "^2.6.2",
45
35
  "@nuxt/eslint": "1.9.0",
46
36
  "@nuxt/eslint-config": "^1.9.0",
@@ -60,5 +50,15 @@
60
50
  "typescript": "~5.9.2",
61
51
  "vitest": "^3.2.4",
62
52
  "vue-tsc": "^3.0.5"
53
+ },
54
+ "scripts": {
55
+ "dev": "npm run dev:prepare && nuxi dev playground",
56
+ "dev:build": "nuxi build playground",
57
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
58
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release && git push --follow-tags",
59
+ "lint": "eslint .",
60
+ "test": "vitest run",
61
+ "test:watch": "vitest watch",
62
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
63
63
  }
64
- }
64
+ }