dochub-sdk 0.1.304 → 0.1.306
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/classes/vue2/Editor.ts +35 -1
- package/interfaces/editors.ts +3 -4
- package/package.json +1 -1
package/classes/vue2/Editor.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
2
|
-
import { Prop,
|
2
|
+
import { Prop, Component } from 'vue-property-decorator';
|
3
3
|
import { DocHubComponentProto } from './Components';
|
4
|
+
import { DocHub, EditorEvents } from '../..';
|
4
5
|
import type { DocHubEditorContext } from '../..';
|
5
6
|
|
6
7
|
@Component
|
@@ -12,4 +13,37 @@ export class DocHubEditorProto extends DocHubComponentProto {
|
|
12
13
|
type: Object,
|
13
14
|
default: null
|
14
15
|
}) readonly context: DocHubEditorContext | null;
|
16
|
+
|
17
|
+
constructor(...params) {
|
18
|
+
super(...params);
|
19
|
+
DocHub.eventBus.$on(EditorEvents.save, this.onSave);
|
20
|
+
DocHub.eventBus.$on(EditorEvents.saveAs, this.onSaveAs);
|
21
|
+
DocHub.eventBus.$on(EditorEvents.goto, this.onGoTo);
|
22
|
+
}
|
23
|
+
|
24
|
+
destroyed(): void {
|
25
|
+
DocHub.eventBus.$off(EditorEvents.save, this.onSave);
|
26
|
+
DocHub.eventBus.$off(EditorEvents.saveAs, this.onSaveAs);
|
27
|
+
DocHub.eventBus.$off(EditorEvents.goto, this.onGoTo);
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Вызывается при необходимости перейти в редакторе на заданную область
|
32
|
+
* @param location
|
33
|
+
*/
|
34
|
+
onGoTo(location: string | RegExp) {
|
35
|
+
console.warn('Goto function is not implemented', location);
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Вызывается при необходимости сохранить результат редактирования
|
39
|
+
*/
|
40
|
+
onSave() {
|
41
|
+
console.warn('Save function is not implemented');
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Вызывается при необходимости сохранить результат в файле с иным названием
|
45
|
+
*/
|
46
|
+
onSaveAs(uri: string) {
|
47
|
+
console.warn('Save as function is not implemented');
|
48
|
+
}
|
15
49
|
}
|
package/interfaces/editors.ts
CHANGED
@@ -65,10 +65,9 @@ export enum EditorEvents {
|
|
65
65
|
/**
|
66
66
|
* События редактора
|
67
67
|
*/
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
delete = '#delete' // Требует удалить объект
|
68
|
+
save = '#edit-save', // Требует произвести сохранение
|
69
|
+
saveAs = '#edit-save-as', // Требует произвести сохранение с новым именем
|
70
|
+
goto = '#edit-goto' // Требует перейти в указанное пространство
|
72
71
|
};
|
73
72
|
/**
|
74
73
|
* Тип редактора
|