@modusoperandi/licit 0.13.20 → 0.13.22
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/.eslintrc.js +3 -0
- package/README.md +3 -1
- package/dist/LinkTooltipPlugin.js +0 -9
- package/dist/LinkTooltipPlugin.js.flow +0 -11
- package/dist/ListItemNodeSpec.js +2 -1
- package/dist/ListItemNodeSpec.js.flow +2 -1
- package/dist/bom.xml +5010 -636
- package/dist/client/Licit.js +10 -0
- package/dist/client/Licit.js.flow +10 -0
- package/licit/client/CustomLicitRuntime.js +84 -26
- package/package.json +4 -4
- package/src/LinkTooltipPlugin.js +0 -11
- package/src/ListItemNodeSpec.js +2 -1
- package/src/client/Licit.js +10 -0
package/dist/client/Licit.js
CHANGED
|
@@ -265,6 +265,16 @@ class Licit extends React.Component {
|
|
|
265
265
|
this.setState(props);
|
|
266
266
|
});
|
|
267
267
|
|
|
268
|
+
_defineProperty(this, "exportPDF", () => {
|
|
269
|
+
const event = new KeyboardEvent('keydown', {
|
|
270
|
+
ctrlKey: true,
|
|
271
|
+
altKey: true,
|
|
272
|
+
keyCode: 80,
|
|
273
|
+
bubbles: false
|
|
274
|
+
});
|
|
275
|
+
this.editorView.dom.dispatchEvent(event);
|
|
276
|
+
});
|
|
277
|
+
|
|
268
278
|
this.initialize(_props);
|
|
269
279
|
}
|
|
270
280
|
|
|
@@ -660,6 +660,16 @@ class Licit extends React.Component<any, any> {
|
|
|
660
660
|
this._skipSCU = false;
|
|
661
661
|
this.setState(props);
|
|
662
662
|
};
|
|
663
|
+
|
|
664
|
+
exportPDF = () => {
|
|
665
|
+
const event = new KeyboardEvent('keydown', {
|
|
666
|
+
ctrlKey: true,
|
|
667
|
+
altKey: true,
|
|
668
|
+
keyCode: 80,
|
|
669
|
+
bubbles: false,
|
|
670
|
+
});
|
|
671
|
+
this.editorView.dom.dispatchEvent(event);
|
|
672
|
+
};
|
|
663
673
|
}
|
|
664
674
|
|
|
665
675
|
export default Licit;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// This implements the interface of `EditorRuntime`.
|
|
4
4
|
// To run editor directly:
|
|
5
5
|
import type { ImageLike } from '../../src/Types';
|
|
6
|
-
import { POST } from '../../src/client/http';
|
|
6
|
+
import { POST, req } from '../../src/client/http';
|
|
7
7
|
|
|
8
8
|
// When use it in a componet:
|
|
9
9
|
|
|
@@ -12,11 +12,7 @@ import { POST } from '../../src/client/http';
|
|
|
12
12
|
import {POST } from '@modusoperandi/licit';
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
class CustomLicitRuntime {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
16
|
// Image Proxy
|
|
21
17
|
canProxyImageSrc(): boolean {
|
|
22
18
|
return false;
|
|
@@ -66,30 +62,92 @@ class CustomLicitRuntime {
|
|
|
66
62
|
});
|
|
67
63
|
}
|
|
68
64
|
|
|
65
|
+
// Video Proxy
|
|
66
|
+
canProxyVideoSrc(): boolean {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
+
getProxyVideoSrc(src: string): string {
|
|
71
|
+
// This simulate a fake proxy.
|
|
72
|
+
const suffix = 'proxied=1';
|
|
73
|
+
return src.indexOf('?') === -1 ? `${src}?${suffix}` : `${src}&${suffix}`;
|
|
74
|
+
}
|
|
70
75
|
|
|
76
|
+
getVideoSrc(id: string): Promise<string> {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const token =
|
|
79
|
+
'Bearer <access_token>';
|
|
80
|
+
const endPoint = 'https://moviacloud.modusoperandi.com/movia/content';
|
|
81
|
+
|
|
82
|
+
(async () => {
|
|
83
|
+
// Video that will be fetched and appended
|
|
84
|
+
const remoteVidUrl = endPoint + '/id/' + id;
|
|
85
|
+
|
|
86
|
+
// Fetch remote URL, getting contents as binary blob
|
|
87
|
+
const vidBlob = await (
|
|
88
|
+
await fetch(remoteVidUrl, { headers: { Authorization: token } })
|
|
89
|
+
).blob();
|
|
90
|
+
|
|
91
|
+
const videoEle = document.createElement('video');
|
|
92
|
+
videoEle.src = URL.createObjectURL(vidBlob);
|
|
93
|
+
videoEle.addEventListener('loadedmetadata', function () {
|
|
94
|
+
resolve(videoEle.src);
|
|
95
|
+
});
|
|
96
|
+
})();
|
|
97
|
+
});
|
|
98
|
+
}
|
|
71
99
|
|
|
100
|
+
// Video Upload
|
|
101
|
+
canUploadVideo(): boolean {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
72
104
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
uploadVideo(blob: Object, id: string): Promise<ImageLike> {
|
|
106
|
+
let img: ImageLike;
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
// Use uploaded image URL.
|
|
109
|
+
const formData = new FormData();
|
|
110
|
+
formData.append('label', blob.name);
|
|
111
|
+
formData.append('file', blob);
|
|
112
|
+
const token =
|
|
113
|
+
'Bearer <access_token>';
|
|
114
|
+
const endPoint = 'https://moviacloud.modusoperandi.com/movia/content';
|
|
115
|
+
req({
|
|
116
|
+
url: endPoint,
|
|
117
|
+
method: 'POST',
|
|
118
|
+
body: formData,
|
|
119
|
+
headers: {
|
|
120
|
+
Authorization: token,
|
|
121
|
+
},
|
|
122
|
+
}).then((data) => {
|
|
123
|
+
const resp = JSON.parse(data);
|
|
124
|
+
const id = resp.entity.id.substring(
|
|
125
|
+
resp.entity.id.lastIndexOf('/') + 1
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
(async () => {
|
|
129
|
+
// Video that will be fetched and appended
|
|
130
|
+
const remoteVidUrl = endPoint + '/id/' + id;
|
|
131
|
+
|
|
132
|
+
// Fetch remote URL, getting contents as binary blob
|
|
133
|
+
const vidBlob = await (
|
|
134
|
+
await fetch(remoteVidUrl, { headers: { Authorization: token } })
|
|
135
|
+
).blob();
|
|
136
|
+
|
|
137
|
+
const videoEle = document.createElement('video');
|
|
138
|
+
videoEle.src = URL.createObjectURL(vidBlob);
|
|
139
|
+
videoEle.addEventListener('loadedmetadata', function () {
|
|
140
|
+
img = {
|
|
141
|
+
id: id,
|
|
142
|
+
width: this.videoWidth,
|
|
143
|
+
height: this.videoHeight,
|
|
144
|
+
src: videoEle.src,
|
|
145
|
+
};
|
|
146
|
+
resolve(img);
|
|
147
|
+
});
|
|
148
|
+
})();
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
94
152
|
}
|
|
95
153
|
export default CustomLicitRuntime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modusoperandi/licit",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.22",
|
|
4
4
|
"subversion": "1",
|
|
5
5
|
"description": "Rich text editor built with React and ProseMirror",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@babel/preset-env": "^7.11.5",
|
|
49
49
|
"@babel/preset-flow": "^7.10.4",
|
|
50
50
|
"@babel/preset-react": "^7.16.0",
|
|
51
|
-
"@cyclonedx/bom": "^
|
|
51
|
+
"@cyclonedx/bom": "^3.10.6",
|
|
52
52
|
"babel-eslint": "10.1.0",
|
|
53
53
|
"babel-jest": "^26.6.3",
|
|
54
54
|
"babel-loader": "8.1.0",
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"terser-webpack-plugin": "^3.1.0",
|
|
86
86
|
"webpack": "^4.44.2",
|
|
87
87
|
"webpack-cli": "^4.9.1",
|
|
88
|
-
"webpack-dev-server": "^
|
|
88
|
+
"webpack-dev-server": "^4.11.1",
|
|
89
89
|
"write-file-webpack-plugin": "4.5.1"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@modusoperandi/licit-doc-attrs-step": "^0.1.3",
|
|
93
|
-
"@modusoperandi/licit-ui-commands": "^0.1.
|
|
93
|
+
"@modusoperandi/licit-ui-commands": "^0.1.8",
|
|
94
94
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
|
95
95
|
"body-parser": "^1.19.0",
|
|
96
96
|
"browserkeymap": "2.0.2",
|
package/src/LinkTooltipPlugin.js
CHANGED
|
@@ -7,7 +7,6 @@ import { EditorView } from 'prosemirror-view';
|
|
|
7
7
|
import { MARK_LINK } from './MarkNames';
|
|
8
8
|
import {
|
|
9
9
|
hideSelectionPlaceholder,
|
|
10
|
-
showSelectionPlaceholder,
|
|
11
10
|
} from './SelectionPlaceholderPlugin';
|
|
12
11
|
import { applyMark } from '@modusoperandi/licit-ui-commands';
|
|
13
12
|
import { findNodesWithSameMark } from '@modusoperandi/licit-ui-commands';
|
|
@@ -127,16 +126,6 @@ class LinkTooltipView {
|
|
|
127
126
|
if (!result) {
|
|
128
127
|
return;
|
|
129
128
|
}
|
|
130
|
-
let { tr } = state;
|
|
131
|
-
const linkSelection = TextSelection.create(
|
|
132
|
-
tr.doc,
|
|
133
|
-
result.from.pos,
|
|
134
|
-
result.to.pos + 1
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
tr = tr.setSelection(linkSelection);
|
|
138
|
-
tr = showSelectionPlaceholder(state, tr);
|
|
139
|
-
view.dispatch(tr);
|
|
140
129
|
|
|
141
130
|
const href = result.mark.attrs.href;
|
|
142
131
|
this._editor = createPopUp(
|
package/src/ListItemNodeSpec.js
CHANGED
|
@@ -29,7 +29,8 @@ const ListItemNodeSpec: NodeSpec = {
|
|
|
29
29
|
// This spec does not support nested lists (e.g. `'paragraph block*'`)
|
|
30
30
|
// as content because of the complexity of dealing with indentation
|
|
31
31
|
// (context: https://github.com/ProseMirror/prosemirror/issues/92).
|
|
32
|
-
content: '(bullet_list|paragraph)+',
|
|
32
|
+
// content: '(bullet_list|paragraph)+',
|
|
33
|
+
content: 'paragraph block*',
|
|
33
34
|
|
|
34
35
|
parseDOM: [{ tag: 'li', getAttrs }],
|
|
35
36
|
|
package/src/client/Licit.js
CHANGED
|
@@ -660,6 +660,16 @@ class Licit extends React.Component<any, any> {
|
|
|
660
660
|
this._skipSCU = false;
|
|
661
661
|
this.setState(props);
|
|
662
662
|
};
|
|
663
|
+
|
|
664
|
+
exportPDF = () => {
|
|
665
|
+
const event = new KeyboardEvent('keydown', {
|
|
666
|
+
ctrlKey: true,
|
|
667
|
+
altKey: true,
|
|
668
|
+
keyCode: 80,
|
|
669
|
+
bubbles: false,
|
|
670
|
+
});
|
|
671
|
+
this.editorView.dom.dispatchEvent(event);
|
|
672
|
+
};
|
|
663
673
|
}
|
|
664
674
|
|
|
665
675
|
export default Licit;
|