@yiitap/extension-video 1.1.0 → 1.2.1

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
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAA;AAEnE,eAAO,MAAM,UAAU,QAAqD,CAAA;AAE5E,OAAO,QAAQ,cAAc,CAAC;IAC7B,UAAU,QAAQ,CAAC,UAAU;QAC5B,KAAK,EAAE;YACN,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,UAAU,CAAA;SACtC,CAAA;KACD;CACD;AAED,eAAO,MAAM,KAAK,gBAiFhB,CAAA"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAA;AAEnE,eAAO,MAAM,UAAU,QAAqD,CAAA;AAE5E,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,KAAK,EAAE;YACL,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,UAAU,CAAA;SACvC,CAAA;KACF;CACF;AAED,eAAO,MAAM,KAAK,gBAiFhB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yiitap/extension-video",
3
3
  "description": "Video extension",
4
- "version": "1.1.0",
4
+ "version": "1.2.1",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "Yiitap",
@@ -29,7 +29,7 @@
29
29
  "devDependencies": {
30
30
  "vite": "^6.2.0",
31
31
  "vite-plugin-dts": "^4.5.3",
32
- "vitest": "^0.34.6"
32
+ "vitest": "^3.0.8"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "pnpm build-lib && pnpm build-types",
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'
2
2
  import { mount } from '@vue/test-utils'
3
3
 
4
4
  describe('Sample Test Suite', () => {
5
- it('mounts', () => {
6
- console.log('just a sample test')
7
- })
5
+ it('mounts', () => {
6
+ console.log('just a sample test')
7
+ })
8
8
  })
package/src/video.ts CHANGED
@@ -3,92 +3,92 @@ import { Node, nodeInputRule, mergeAttributes } from '@tiptap/core'
3
3
  export const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/
4
4
 
5
5
  declare module '@tiptap/core' {
6
- interface Commands<ReturnType> {
7
- video: {
8
- setVideo: (options: any) => ReturnType
9
- }
10
- }
6
+ interface Commands<ReturnType> {
7
+ video: {
8
+ setVideo: (options: any) => ReturnType
9
+ }
10
+ }
11
11
  }
12
12
 
13
13
  export const Video = Node.create({
14
- name: 'video',
15
- draggable: true,
14
+ name: 'video',
15
+ draggable: true,
16
16
 
17
- addOptions() {
18
- return {
19
- inline: false,
20
- HTMLAttributes: {},
21
- }
22
- },
17
+ addOptions() {
18
+ return {
19
+ inline: false,
20
+ HTMLAttributes: {},
21
+ }
22
+ },
23
23
 
24
- inline() {
25
- return this.options.inline
26
- },
24
+ inline() {
25
+ return this.options.inline
26
+ },
27
27
 
28
- group() {
29
- return this.options.inline ? 'inline' : 'block'
30
- },
28
+ group() {
29
+ return this.options.inline ? 'inline' : 'block'
30
+ },
31
31
 
32
- addAttributes() {
33
- return {
34
- // small, medium, large
35
- caption: {
36
- default: '',
37
- rendered: false,
38
- },
39
- src: {
40
- default: null,
41
- parseHTML: (element) => {
42
- const child = element.firstElementChild as HTMLVideoElement | null
43
- const src = child?.src ?? ''
44
- return src
45
- },
46
- },
47
- }
48
- },
32
+ addAttributes() {
33
+ return {
34
+ // small, medium, large
35
+ caption: {
36
+ default: '',
37
+ rendered: false,
38
+ },
39
+ src: {
40
+ default: null,
41
+ parseHTML: (element) => {
42
+ const child = element.firstElementChild as HTMLVideoElement | null
43
+ const src = child?.src ?? ''
44
+ return src
45
+ },
46
+ },
47
+ }
48
+ },
49
49
 
50
- parseHTML() {
51
- return [
52
- {
53
- tag: 'video',
54
- },
55
- ]
56
- },
50
+ parseHTML() {
51
+ return [
52
+ {
53
+ tag: 'video',
54
+ },
55
+ ]
56
+ },
57
57
 
58
- renderHTML({ node, HTMLAttributes }) {
59
- return [
60
- 'video',
61
- {
62
- caption: node.attrs.caption,
63
- },
64
- ['source', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)],
65
- ]
66
- },
58
+ renderHTML({ node, HTMLAttributes }) {
59
+ return [
60
+ 'video',
61
+ {
62
+ caption: node.attrs.caption,
63
+ },
64
+ ['source', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)],
65
+ ]
66
+ },
67
67
 
68
- addCommands() {
69
- return {
70
- setVideo:
71
- (options: any) =>
72
- ({ commands }) => {
73
- return commands.insertContent({
74
- type: this.name,
75
- attrs: options,
76
- })
77
- },
78
- }
79
- },
68
+ addCommands() {
69
+ return {
70
+ setVideo:
71
+ (options: any) =>
72
+ ({ commands }) => {
73
+ return commands.insertContent({
74
+ type: this.name,
75
+ attrs: options,
76
+ })
77
+ },
78
+ }
79
+ },
80
80
 
81
- addInputRules() {
82
- return [
83
- nodeInputRule({
84
- find: inputRegex,
85
- type: this.type,
86
- getAttributes: (match) => {
87
- const [src] = match
81
+ addInputRules() {
82
+ return [
83
+ nodeInputRule({
84
+ find: inputRegex,
85
+ type: this.type,
86
+ getAttributes: (match) => {
87
+ const [src] = match
88
88
 
89
- return { src }
90
- },
91
- }),
92
- ]
93
- },
89
+ return { src }
90
+ },
91
+ }),
92
+ ]
93
+ },
94
94
  })