@seorii/tiptap 0.0.6 → 0.0.7

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.
@@ -1,7 +1,2 @@
1
- declare const _default: import("@tiptap/core").Node<{
2
- sizes: string[];
3
- inline: boolean;
4
- allowBase64: boolean;
5
- HTMLAttributes: Record<string, any>;
6
- }, any>;
1
+ declare const _default: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
7
2
  export default _default;
@@ -1,7 +1,12 @@
1
1
  import Image from "@tiptap/extension-image";
2
2
  import { mergeAttributes } from "@tiptap/core";
3
3
  export default Image.extend({
4
- defaultOptions: { ...Image.options, sizes: ["inline", "block", "left", "right"] },
4
+ addOptions() {
5
+ return {
6
+ ...this.parent?.(),
7
+ sizes: ["inline", "block", "left", "right"],
8
+ };
9
+ },
5
10
  parseHTML: () => [{ tag: 'img' }],
6
11
  renderHTML({ HTMLAttributes }) {
7
12
  const { style } = HTMLAttributes;
@@ -2,10 +2,10 @@
2
2
  import { onMount, setContext } from 'svelte';
3
3
  import { Card, Input } from "nunui";
4
4
  import { writable } from "svelte/store";
5
- import "tiptap-katex/style.css";
6
5
  import sanitizeHtml from 'sanitize-html';
6
+ import "@seorii/prosemirror-math/style.css";
7
7
  const san = (body, force = false) => (editor || force) ? body : sanitizeHtml(body, {
8
- allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'math-inline', 'iframe', 'tiptap-file']),
8
+ allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'math-inline', 'math-node', 'iframe', 'tiptap-file']),
9
9
  allowedStyles: '*', allowedAttributes: {
10
10
  '*': ['style', 'class'],
11
11
  a: ['href', 'name', 'target'],
@@ -115,6 +115,11 @@ div > :global(div) :global(img) {
115
115
  border-radius: 12px;
116
116
  position: relative;
117
117
  }
118
+ div > :global(div) :global(code.inline) {
119
+ background: var(--primary-light1);
120
+ padding: 2px 4px;
121
+ border-radius: 4px;
122
+ }
118
123
  div > :global(div) :global(pre) {
119
124
  background: var(--primary-light1);
120
125
  padding: 12px;
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import "tiptap-katex/style.css";
2
+ import "@seorii/prosemirror-math/style.css";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  body?: string | undefined;
@@ -1,6 +1,7 @@
1
1
  import { Editor, mergeAttributes } from "@tiptap/core";
2
2
  import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
3
3
  import { lowlight } from "lowlight";
4
+ import Code from "@tiptap/extension-code";
4
5
  import Image from "../plugin/image";
5
6
  import StarterKit from "@tiptap/starter-kit";
6
7
  import Underline from "@tiptap/extension-underline";
@@ -20,8 +21,8 @@ import { Indent } from "../plugin/indent";
20
21
  import { Color } from '@tiptap/extension-color';
21
22
  import TextStyle from '@tiptap/extension-text-style';
22
23
  import Iframe from "../plugin/iframe";
23
- //@ts-ignore
24
- import Math from "tiptap-katex";
24
+ // @ts-ignore
25
+ import { Katex } from "@seorii/prosemirror-math/tiptap";
25
26
  export default (element, content, { placeholder = '내용을 입력하세요...', plugins = [], ...props } = {}) => new Editor({
26
27
  element, content, ...props,
27
28
  extensions: [
@@ -44,8 +45,13 @@ export default (element, content, { placeholder = '내용을 입력하세요...'
44
45
  Indent,
45
46
  Color,
46
47
  TextStyle,
47
- Math,
48
+ Katex,
48
49
  Iframe,
50
+ Code.extend({
51
+ renderHTML({ HTMLAttributes }) {
52
+ return ['code', mergeAttributes(HTMLAttributes, { class: 'inline' })];
53
+ }
54
+ }),
49
55
  ...plugins,
50
56
  ],
51
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seorii/tiptap",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "svelte-kit sync && svelte-package",
@@ -31,8 +31,9 @@
31
31
  },
32
32
  "type": "module",
33
33
  "dependencies": {
34
- "@seorii/prosemirror-math": "^0.3.0",
34
+ "@seorii/prosemirror-math": "^0.3.7",
35
35
  "@tiptap/core": "^2.0.4",
36
+ "@tiptap/extension-code": "^2.0.4",
36
37
  "@tiptap/extension-code-block-lowlight": "^2.0.4",
37
38
  "@tiptap/extension-color": "^2.0.4",
38
39
  "@tiptap/extension-dropcursor": "^2.0.4",
@@ -58,8 +59,7 @@
58
59
  "prosemirror-tables": "^1.3.4",
59
60
  "prosemirror-transform": "^1.7.4",
60
61
  "prosemirror-view": "^1.31.7",
61
- "sanitize-html": "^2.11.0",
62
- "tiptap-katex": "0.0.6"
62
+ "sanitize-html": "^2.11.0"
63
63
  },
64
64
  "exports": {
65
65
  ".": {