tiptap-extension-shiki 1.0.3 → 1.0.5

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 +1 @@
1
- .tiptap-shiki--container{border-radius:.4rem;font-size:.875em}.tiptap-shiki--container pre{max-height:400px;overflow:auto;padding:1.25rem}.tiptap-shiki--container.show-line-numbers pre{padding-left:0}.tiptap-shiki--line-number{box-sizing:border-box;display:inline-block;padding-right:2em;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:5em}.tiptap-shiki--toolbar{align-items:center;display:flex;padding:.75rem}
1
+ .tiptap-shiki--container{border-radius:.4rem;font-size:.875em}.tiptap-shiki--container pre{max-height:400px;overflow:auto;padding:1.25rem}.tiptap-shiki--container.show-line-numbers pre{padding-left:5em}.tiptap-shiki--container.show-line-numbers span{word-break:break-all}.tiptap-shiki--container.show-line-numbers span.tiptap-shiki--line-number{margin-left:-5em;word-break:normal}.tiptap-shiki--line-number{box-sizing:border-box;display:inline-block;padding-right:2em;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:5em}.tiptap-shiki--toolbar{align-items:center;display:flex;padding:.75rem}
package/dist/index.cjs.js CHANGED
@@ -314,6 +314,8 @@ const TiptapShiki = CodeBlock.extend({
314
314
  container.innerHTML = highlightedCode;
315
315
  if (container.firstElementChild) {
316
316
  const rsDOM = container.firstElementChild;
317
+ if (this.options.extraRenderPrependDOM)
318
+ rsDOM.prepend(this.options.extraRenderPrependDOM);
317
319
  Object.keys(HTMLAttributes).forEach((key) => {
318
320
  rsDOM.setAttribute(key, HTMLAttributes[key]);
319
321
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .tiptap-shiki--container{border-radius:.4rem;font-size:.875em}.tiptap-shiki--container pre{max-height:400px;overflow:auto;padding:1.25rem}.tiptap-shiki--container.show-line-numbers pre{padding-left:0}.tiptap-shiki--line-number{box-sizing:border-box;display:inline-block;padding-right:2em;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:5em}.tiptap-shiki--toolbar{align-items:center;display:flex;padding:.75rem}
1
+ .tiptap-shiki--container{border-radius:.4rem;font-size:.875em}.tiptap-shiki--container pre{max-height:400px;overflow:auto;padding:1.25rem}.tiptap-shiki--container.show-line-numbers pre{padding-left:5em}.tiptap-shiki--container.show-line-numbers span{word-break:break-all}.tiptap-shiki--container.show-line-numbers span.tiptap-shiki--line-number{margin-left:-5em;word-break:normal}.tiptap-shiki--line-number{box-sizing:border-box;display:inline-block;padding-right:2em;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:5em}.tiptap-shiki--toolbar{align-items:center;display:flex;padding:.75rem}
package/dist/index.d.ts CHANGED
@@ -30,6 +30,7 @@ declare const TiptapShiki: import("@tiptap/core").Node<{
30
30
  styles?: Record<string, string>;
31
31
  attrs?: Record<string, string>;
32
32
  };
33
+ extraRenderPrependDOM?: HTMLElement;
33
34
  showLineNumbers?: boolean;
34
35
  renderToolbar?: (props: {
35
36
  toolbarDOM: HTMLElement;
package/dist/index.js CHANGED
@@ -310,6 +310,8 @@ const TiptapShiki = CodeBlock.extend({
310
310
  container.innerHTML = highlightedCode;
311
311
  if (container.firstElementChild) {
312
312
  const rsDOM = container.firstElementChild;
313
+ if (this.options.extraRenderPrependDOM)
314
+ rsDOM.prepend(this.options.extraRenderPrependDOM);
313
315
  Object.keys(HTMLAttributes).forEach((key) => {
314
316
  rsDOM.setAttribute(key, HTMLAttributes[key]);
315
317
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiptap-extension-shiki",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
package/src/index.css CHANGED
@@ -28,7 +28,16 @@
28
28
  }
29
29
 
30
30
  .tiptap-shiki--container.show-line-numbers pre {
31
- padding-left: 0;
31
+ /* padding-left: 0; */
32
+ padding-left: 5em;
33
+ }
34
+
35
+ .tiptap-shiki--container.show-line-numbers span {
36
+ word-break: break-all;
37
+ }
38
+ .tiptap-shiki--container.show-line-numbers span.tiptap-shiki--line-number {
39
+ margin-left: -5em;
40
+ word-break: normal;
32
41
  }
33
42
 
34
43
  .tiptap-shiki--line-number {
@@ -50,4 +59,4 @@
50
59
 
51
60
  /* 设置工具栏内边距 */
52
61
  padding: 0.75rem;
53
- }
62
+ }
package/src/index.ts CHANGED
@@ -53,6 +53,7 @@ const TiptapShiki = CodeBlock.extend<
53
53
  styles?: Record<string, string>;
54
54
  attrs?: Record<string, string>;
55
55
  };
56
+ extraRenderPrependDOM?: HTMLElement;
56
57
  // 显示行号
57
58
  showLineNumbers?: boolean;
58
59
  // 自定义工具栏渲染函数
@@ -188,6 +189,10 @@ const TiptapShiki = CodeBlock.extend<
188
189
  container.innerHTML = highlightedCode;
189
190
  if (container.firstElementChild) {
190
191
  const rsDOM = container.firstElementChild as HTMLElement;
192
+
193
+ if (this.options.extraRenderPrependDOM)
194
+ rsDOM.prepend(this.options.extraRenderPrependDOM);
195
+
191
196
  Object.keys(HTMLAttributes).forEach((key) => {
192
197
  rsDOM.setAttribute(key, HTMLAttributes[key]);
193
198
  });