@seorii/tiptap 0.2.1 → 0.2.2
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/i18n/en-us/index.d.ts +1 -0
- package/dist/i18n/en-us/index.js +2 -1
- package/dist/i18n/ko-kr/index.d.ts +1 -0
- package/dist/i18n/ko-kr/index.js +2 -1
- package/dist/tiptap/Command.svelte +1 -1
- package/dist/tiptap/TipTap.svelte +8 -2
- package/dist/tiptap/TipTap.svelte.d.ts +1 -0
- package/dist/tiptap/tiptap.d.ts +1 -1
- package/dist/tiptap/tiptap.js +4 -1
- package/package.json +1 -1
package/dist/i18n/en-us/index.js
CHANGED
|
@@ -38,5 +38,6 @@ export default {
|
|
|
38
38
|
iframeInfo: 'Embed another website',
|
|
39
39
|
youtubeInfo: 'Embed Youtube video',
|
|
40
40
|
blockquoteInfo: 'Blockquote',
|
|
41
|
-
newLineInfo: 'Press / to enter commands. Or'
|
|
41
|
+
newLineInfo: 'Press / to enter commands. Or',
|
|
42
|
+
placeholder: 'Enter content here...',
|
|
42
43
|
};
|
package/dist/i18n/ko-kr/index.js
CHANGED
|
@@ -24,7 +24,7 @@ const san = (body) => sanitizeHtml(body, {
|
|
|
24
24
|
});
|
|
25
25
|
export let body = '', editable = false, ref = null, options = {};
|
|
26
26
|
export let imageUpload = fallbackUpload, style = '';
|
|
27
|
-
export let blocks = [];
|
|
27
|
+
export let blocks = [], placeholder = i18n('placeholder');
|
|
28
28
|
const tiptap = setContext('editor', writable(null));
|
|
29
29
|
let element, fullscreen = false, mounted = false, last = '';
|
|
30
30
|
$: $tiptap && $tiptap.setEditable(editable);
|
|
@@ -38,6 +38,7 @@ if (browser) {
|
|
|
38
38
|
if (!mounted)
|
|
39
39
|
return;
|
|
40
40
|
ref = $tiptap = tt(element, body, {
|
|
41
|
+
placeholder,
|
|
41
42
|
editable: editable,
|
|
42
43
|
onTransaction: () => ref = $tiptap = $tiptap,
|
|
43
44
|
...options,
|
|
@@ -160,11 +161,16 @@ div > :global(div) {
|
|
|
160
161
|
outline: none !important;
|
|
161
162
|
}
|
|
162
163
|
div > :global(div) :global(.ProseMirror) :global(p.is-editor-empty:first-child::before) {
|
|
163
|
-
color: #
|
|
164
|
+
color: var(--on-surface, #000);
|
|
165
|
+
opacity: 0.7;
|
|
164
166
|
content: attr(data-placeholder);
|
|
165
167
|
float: left;
|
|
166
168
|
height: 0;
|
|
167
169
|
pointer-events: none;
|
|
170
|
+
transition: 0.2s opacity ease-in-out;
|
|
171
|
+
}
|
|
172
|
+
div > :global(div) :global(.ProseMirror-focused) :global(p.is-editor-empty:first-child::before) {
|
|
173
|
+
opacity: 0;
|
|
168
174
|
}
|
|
169
175
|
div > :global(div) :global(a) {
|
|
170
176
|
cursor: pointer;
|
package/dist/tiptap/tiptap.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/core";
|
|
2
|
-
declare const _default: (element: Element, content: string, { plugins, ...props }?: any) => Editor;
|
|
2
|
+
declare const _default: (element: Element, content: string, { placeholder, plugins, ...props }?: any) => Editor;
|
|
3
3
|
export default _default;
|
package/dist/tiptap/tiptap.js
CHANGED
|
@@ -23,9 +23,11 @@ import Iframe from "../plugin/iframe";
|
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
import { MathInline, MathBlock } from "@seorii/prosemirror-math/tiptap";
|
|
25
25
|
import Youtube from "../plugin/youtube";
|
|
26
|
+
import Placeholder from "@tiptap/extension-placeholder";
|
|
26
27
|
import command from "../plugin/command/suggest";
|
|
27
28
|
import emoji from "../plugin/command/emoji";
|
|
28
|
-
|
|
29
|
+
import i18n from "../i18n";
|
|
30
|
+
export default (element, content, { placeholder = i18n('placeholder'), plugins = [], ...props } = {}) => {
|
|
29
31
|
const tt = new Editor({
|
|
30
32
|
element, content, ...props,
|
|
31
33
|
extensions: [
|
|
@@ -73,6 +75,7 @@ export default (element, content, { plugins = [], ...props } = {}) => {
|
|
|
73
75
|
return ['code', mergeAttributes(HTMLAttributes, { class: 'inline' })];
|
|
74
76
|
}
|
|
75
77
|
}),
|
|
78
|
+
Placeholder.configure({ placeholder }),
|
|
76
79
|
...plugins,
|
|
77
80
|
],
|
|
78
81
|
});
|