@onereach/ui-components 4.1.1 → 4.2.0-beta.2544.0
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/bundled/v2/components/OrCode/OrCode.js +6 -3727
- package/dist/bundled/v2/components/OrCode/index.js +6 -2
- package/dist/bundled/v2/components/OrCode/lang.js +3897 -3
- package/dist/bundled/v2/components/OrCode/theme.js +2 -1
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +1 -0
- package/dist/bundled/v2/components/OrConfirm/index.js +1 -0
- package/dist/bundled/v2/components/OrModal/OrModal.js +3 -1266
- package/dist/bundled/v2/components/OrModal/index.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1988 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +68 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +15 -2
- package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-c5a9adb7.js → v2/index-16aee5bc.js} +14 -234
- package/dist/bundled/v2/index-62c3221b.js +6956 -0
- package/dist/bundled/{v3/lang-02d2bb2d.js → v2/index-70ca38c5.js} +73 -3965
- package/dist/bundled/v2/{index-6976c52a.js → index-f5487f12.js} +3 -115
- package/dist/bundled/v2/index.es-3f39f316.js +115 -0
- package/dist/bundled/v2/index.js +18 -5
- package/dist/bundled/v2/markdown-516daba9.js +18737 -0
- package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-d5fb0b11.js → v2/useFocusTrap-9567b3c8.js} +3 -105
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f6f74339.js +236 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-806d209b.js → OrConfirm.vue_vue_type_script_lang-36318ca2.js} +1 -1
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-af0c4288.js +107 -0
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-2bb9d87f.js +1765 -0
- package/dist/bundled/v3/components/OrCode/OrCode.js +10 -6
- package/dist/bundled/v3/components/OrCode/index.js +8 -4
- package/dist/bundled/v3/components/OrCode/lang.js +3897 -3
- package/dist/bundled/v3/components/OrCode/theme.js +2 -1
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +4 -3
- package/dist/bundled/v3/components/OrConfirm/index.js +3 -2
- package/dist/bundled/v3/components/OrModal/OrModal.js +3 -2
- package/dist/bundled/v3/components/OrModal/index.js +2 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +227 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +84 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +19 -5
- package/dist/bundled/v3/index-16aee5bc.js +3740 -0
- package/dist/bundled/v3/index-62c3221b.js +6956 -0
- package/dist/bundled/{v2/lang-02d2bb2d.js → v3/index-70ca38c5.js} +73 -3965
- package/dist/bundled/v3/{index-6976c52a.js → index-f5487f12.js} +3 -115
- package/dist/bundled/v3/index.es-3f39f316.js +115 -0
- package/dist/bundled/v3/index.js +23 -9
- package/dist/bundled/v3/markdown-516daba9.js +18737 -0
- package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/v3/useFocusTrap-9567b3c8.js +1268 -0
- package/dist/esm/v2/OrRichTextEditor-dfddef2b.js +722 -0
- package/dist/esm/v2/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +59 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v2/index.js +24 -0
- package/dist/esm/v3/OrRichTextEditor-f4ce18ef.js +686 -0
- package/dist/esm/v3/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +57 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v3/index.js +24 -0
- package/package.json +25 -5
- package/src/components/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +7 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +103 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +624 -0
- package/src/components/or-rich-text-editor-v3/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +64 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +254 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +213 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +117 -0
package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-d5fb0b11.js → v2/useFocusTrap-9567b3c8.js}
RENAMED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { OrModalSizes } from './components/OrModal/constants.js';
|
|
4
|
-
import { unrefElement, tryOnScopeDispose, onClickOutside } from '@vueuse/core';
|
|
5
|
-
import './components/OrIconButtonV2/OrIconButton.js';
|
|
6
|
-
import './components/OrOverlay/OrOverlay.js';
|
|
7
|
-
import { s as script$2 } from './OrOverlay.vue_vue_type_script_lang-2f5d626d.js';
|
|
8
|
-
import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-5d204461.js';
|
|
1
|
+
import { unrefElement, tryOnScopeDispose } from '@vueuse/core';
|
|
2
|
+
import { ref, watch } from 'vue-demi';
|
|
9
3
|
|
|
10
4
|
/*!
|
|
11
5
|
* tabbable 6.0.1
|
|
@@ -1271,100 +1265,4 @@ function useFocusTrap(target, options = {}) {
|
|
|
1271
1265
|
};
|
|
1272
1266
|
}
|
|
1273
1267
|
|
|
1274
|
-
|
|
1275
|
-
name: 'OrModal',
|
|
1276
|
-
components: {
|
|
1277
|
-
OrIconButton: script$1,
|
|
1278
|
-
OrOverlay: script$2
|
|
1279
|
-
},
|
|
1280
|
-
props: {
|
|
1281
|
-
titleText: {
|
|
1282
|
-
type: String,
|
|
1283
|
-
required: false,
|
|
1284
|
-
default: null,
|
|
1285
|
-
validator: _.isString
|
|
1286
|
-
},
|
|
1287
|
-
showClose: {
|
|
1288
|
-
type: Boolean,
|
|
1289
|
-
default: true,
|
|
1290
|
-
validator: _.isBoolean
|
|
1291
|
-
},
|
|
1292
|
-
closeOnClickOutside: {
|
|
1293
|
-
type: Boolean,
|
|
1294
|
-
required: false,
|
|
1295
|
-
default: false,
|
|
1296
|
-
validator: _.isBoolean
|
|
1297
|
-
},
|
|
1298
|
-
size: {
|
|
1299
|
-
type: String,
|
|
1300
|
-
required: false,
|
|
1301
|
-
default: OrModalSizes.small
|
|
1302
|
-
},
|
|
1303
|
-
isOpen: {
|
|
1304
|
-
type: Boolean,
|
|
1305
|
-
required: true,
|
|
1306
|
-
validator: _.isBoolean
|
|
1307
|
-
},
|
|
1308
|
-
isWithoutOverlay: {
|
|
1309
|
-
type: Boolean,
|
|
1310
|
-
required: false,
|
|
1311
|
-
default: false,
|
|
1312
|
-
validator: _.isBoolean
|
|
1313
|
-
},
|
|
1314
|
-
trapFocus: {
|
|
1315
|
-
type: Boolean,
|
|
1316
|
-
default: true,
|
|
1317
|
-
validator: _.isBoolean
|
|
1318
|
-
}
|
|
1319
|
-
},
|
|
1320
|
-
emits: ['close'],
|
|
1321
|
-
setup(props, {
|
|
1322
|
-
emit
|
|
1323
|
-
}) {
|
|
1324
|
-
const overlay = ref();
|
|
1325
|
-
let container = ref(null);
|
|
1326
|
-
let trap = useFocusTrap(container, {
|
|
1327
|
-
immediate: props.trapFocus,
|
|
1328
|
-
fallbackFocus: '.container',
|
|
1329
|
-
allowOutsideClick: true
|
|
1330
|
-
});
|
|
1331
|
-
const handleClose = () => emit('close');
|
|
1332
|
-
onClickOutside(container, evt => {
|
|
1333
|
-
if (!evt.composedPath().includes(overlay.value.$el)) return;
|
|
1334
|
-
if (props.closeOnClickOutside) handleClose();
|
|
1335
|
-
});
|
|
1336
|
-
const toggleFocusTrap = isNeedToTrap => {
|
|
1337
|
-
if (isNeedToTrap && props.isOpen) {
|
|
1338
|
-
trap.activate();
|
|
1339
|
-
} else {
|
|
1340
|
-
trap === null || trap === void 0 ? void 0 : trap.deactivate();
|
|
1341
|
-
}
|
|
1342
|
-
};
|
|
1343
|
-
watch(() => props.trapFocus, toggleFocusTrap, {
|
|
1344
|
-
immediate: true
|
|
1345
|
-
});
|
|
1346
|
-
watch(() => props.isOpen, isOpen => {
|
|
1347
|
-
toggleFocusTrap(false);
|
|
1348
|
-
if (isOpen) {
|
|
1349
|
-
container = ref(null);
|
|
1350
|
-
} else {
|
|
1351
|
-
trap === null || trap === void 0 ? void 0 : trap.deactivate();
|
|
1352
|
-
}
|
|
1353
|
-
});
|
|
1354
|
-
onBeforeUnmount(() => {
|
|
1355
|
-
trap === null || trap === void 0 ? void 0 : trap.deactivate();
|
|
1356
|
-
});
|
|
1357
|
-
return {
|
|
1358
|
-
container,
|
|
1359
|
-
overlay,
|
|
1360
|
-
handleClose
|
|
1361
|
-
};
|
|
1362
|
-
},
|
|
1363
|
-
computed: {
|
|
1364
|
-
sizeClass() {
|
|
1365
|
-
return `is-${this.size}`;
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
});
|
|
1369
|
-
|
|
1370
|
-
export { script as s };
|
|
1268
|
+
export { useFocusTrap as u };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { E as EditorView, a as EditorState, k as keymap } from './index-f5487f12.js';
|
|
2
|
+
import { b as basicSetup, i as indentWithTab } from './index-16aee5bc.js';
|
|
3
|
+
import { useElementHover } from '@vueuse/core';
|
|
4
|
+
import { defineComponent, ref } from 'vue-demi';
|
|
5
|
+
import script$3 from './components/OrTeleport/OrTeleport.js';
|
|
6
|
+
import { OrCodeLanguages } from './components/OrCode/constants.js';
|
|
7
|
+
import languages from './components/OrCode/lang.js';
|
|
8
|
+
import theme from './components/OrCode/theme.js';
|
|
9
|
+
import './components/OrIconButtonV2/OrIconButton.js';
|
|
10
|
+
import './components/OrModal/OrModal.js';
|
|
11
|
+
import { s as script$2 } from './OrModal.vue_vue_type_script_lang-af0c4288.js';
|
|
12
|
+
import './components/OrError/OrError.js';
|
|
13
|
+
import './components/OrHint/OrHint.js';
|
|
14
|
+
import './components/OrLabel/OrLabel.js';
|
|
15
|
+
import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-5d204461.js';
|
|
16
|
+
import { s as script$4 } from './OrError.vue_vue_type_script_lang-450321b8.js';
|
|
17
|
+
import { s as script$5 } from './OrHint.vue_vue_type_script_lang-5d628c6c.js';
|
|
18
|
+
import { s as script$6 } from './OrLabel.vue_vue_type_script_lang-95601b40.js';
|
|
19
|
+
|
|
20
|
+
//partially based on https://github.com/logue/vue-codemirror6/blob/master/src/components/CodeMirror.vue
|
|
21
|
+
var script = defineComponent({
|
|
22
|
+
name: 'OrCode',
|
|
23
|
+
components: {
|
|
24
|
+
OrIconButton: script$1,
|
|
25
|
+
OrModal: script$2,
|
|
26
|
+
OrTeleport: script$3,
|
|
27
|
+
OrError: script$4,
|
|
28
|
+
OrHint: script$5,
|
|
29
|
+
OrLabel: script$6
|
|
30
|
+
},
|
|
31
|
+
model: {
|
|
32
|
+
prop: 'modelValue',
|
|
33
|
+
event: 'update:modelValue'
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
label: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: '',
|
|
39
|
+
required: false
|
|
40
|
+
},
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
required: false
|
|
45
|
+
},
|
|
46
|
+
language: {
|
|
47
|
+
type: [Object, String],
|
|
48
|
+
required: false,
|
|
49
|
+
default: OrCodeLanguages.JS
|
|
50
|
+
},
|
|
51
|
+
isReadonly: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
required: false,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
extensions: {
|
|
57
|
+
type: Array,
|
|
58
|
+
required: false,
|
|
59
|
+
default: () => [basicSetup]
|
|
60
|
+
},
|
|
61
|
+
phrases: {
|
|
62
|
+
type: Object,
|
|
63
|
+
required: false,
|
|
64
|
+
default: null
|
|
65
|
+
},
|
|
66
|
+
isShowingFullscreen: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true,
|
|
69
|
+
required: false
|
|
70
|
+
},
|
|
71
|
+
isInvalid: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false,
|
|
74
|
+
required: false
|
|
75
|
+
},
|
|
76
|
+
error: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: '',
|
|
79
|
+
required: false
|
|
80
|
+
},
|
|
81
|
+
hint: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: '',
|
|
84
|
+
required: false
|
|
85
|
+
},
|
|
86
|
+
allowPaste: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true
|
|
89
|
+
},
|
|
90
|
+
allowDrop: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true
|
|
93
|
+
},
|
|
94
|
+
lineWrapping: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
emits: ['update:modelValue', 'focus', 'blur'],
|
|
100
|
+
setup(props, {
|
|
101
|
+
emit
|
|
102
|
+
}) {
|
|
103
|
+
// editor config
|
|
104
|
+
const root = ref();
|
|
105
|
+
const target = ref();
|
|
106
|
+
const fullscreenTarget = ref();
|
|
107
|
+
const isHovered = useElementHover(root);
|
|
108
|
+
const editor = new EditorView({
|
|
109
|
+
state: EditorState.create({
|
|
110
|
+
doc: props.modelValue
|
|
111
|
+
}),
|
|
112
|
+
dispatch: tr => {
|
|
113
|
+
editor.update([tr]);
|
|
114
|
+
if (tr.changes.empty) return;
|
|
115
|
+
emit('update:modelValue', editor.state.doc.toString());
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
root,
|
|
120
|
+
target,
|
|
121
|
+
fullscreenTarget,
|
|
122
|
+
editor,
|
|
123
|
+
isHovered
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
data() {
|
|
127
|
+
return {
|
|
128
|
+
isFullscreen: false
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
computed: {
|
|
132
|
+
localLanguage() {
|
|
133
|
+
if (Object.values(OrCodeLanguages).includes(this.language)) {
|
|
134
|
+
return languages[this.language];
|
|
135
|
+
} else {
|
|
136
|
+
return this.language;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
localExtensions() {
|
|
140
|
+
const {
|
|
141
|
+
allowDrop,
|
|
142
|
+
allowPaste,
|
|
143
|
+
lineWrapping,
|
|
144
|
+
extensions
|
|
145
|
+
} = this;
|
|
146
|
+
let ext = [theme, EditorView.baseTheme({}),
|
|
147
|
+
// locale settings
|
|
148
|
+
this.phrases ? EditorState.phrases.of(this.phrases) : undefined,
|
|
149
|
+
// Parser language setting
|
|
150
|
+
this.localLanguage,
|
|
151
|
+
// Editable option
|
|
152
|
+
EditorView.editable.of(!this.isReadonly),
|
|
153
|
+
// Focus and blur listener
|
|
154
|
+
EditorView.updateListener.of(viewUpdate => {
|
|
155
|
+
if (viewUpdate.focusChanged) {
|
|
156
|
+
viewUpdate.view.hasFocus ? this.$emit('focus') : this.$emit('blur', viewUpdate.state.doc.toString());
|
|
157
|
+
}
|
|
158
|
+
}), EditorView.domEventHandlers({
|
|
159
|
+
drop(event) {
|
|
160
|
+
if (!allowDrop) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
paste(event) {
|
|
166
|
+
if (!allowPaste) {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
// line wrapping
|
|
173
|
+
lineWrapping ? EditorView.lineWrapping : undefined, keymap.of([indentWithTab])];
|
|
174
|
+
if (Array.isArray(extensions)) {
|
|
175
|
+
ext = [...ext, ...extensions];
|
|
176
|
+
}
|
|
177
|
+
ext = ext.filter(Boolean);
|
|
178
|
+
return ext;
|
|
179
|
+
},
|
|
180
|
+
isShowingError() {
|
|
181
|
+
return !!this.error && this.isInvalid;
|
|
182
|
+
},
|
|
183
|
+
isShowingHint() {
|
|
184
|
+
return !!this.hint && !this.isShowingError;
|
|
185
|
+
},
|
|
186
|
+
isShowingHeader() {
|
|
187
|
+
var _a;
|
|
188
|
+
return this.isShowingFullscreen || this.$slots.label || this.$slots.actions || ((_a = this.$scopedSlots) === null || _a === void 0 ? void 0 : _a.actions);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
watch: {
|
|
192
|
+
modelValue(value) {
|
|
193
|
+
if (this.editor.composing) return;
|
|
194
|
+
if (this.editor.state.doc.toString() === value) return;
|
|
195
|
+
const previous = this.editor.state.selection;
|
|
196
|
+
this.editor.setState(EditorState.create({
|
|
197
|
+
doc: value,
|
|
198
|
+
extensions: this.localExtensions,
|
|
199
|
+
selection: previous.ranges.some(range => range.to > value.length) ? {
|
|
200
|
+
anchor: value.length
|
|
201
|
+
} : previous
|
|
202
|
+
}));
|
|
203
|
+
},
|
|
204
|
+
isFullscreen(value) {
|
|
205
|
+
if (value) {
|
|
206
|
+
this.fullscreenTarget.append(this.editor.dom);
|
|
207
|
+
} else {
|
|
208
|
+
this.target.append(this.editor.dom);
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
localExtensions() {
|
|
212
|
+
this.updateEditorState();
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
mounted() {
|
|
216
|
+
this.updateEditorState();
|
|
217
|
+
this.target.append(this.editor.dom);
|
|
218
|
+
},
|
|
219
|
+
beforeUnmount() {
|
|
220
|
+
var _a;
|
|
221
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
222
|
+
},
|
|
223
|
+
methods: {
|
|
224
|
+
updateEditorState() {
|
|
225
|
+
this.editor.setState(EditorState.create({
|
|
226
|
+
doc: this.modelValue,
|
|
227
|
+
extensions: this.localExtensions
|
|
228
|
+
}));
|
|
229
|
+
},
|
|
230
|
+
toggleFullscreen(value) {
|
|
231
|
+
this.isFullscreen = value === undefined ? !this.isFullscreen : value;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export { script as s };
|
|
@@ -7,7 +7,7 @@ import './components/OrModal/OrModal.js';
|
|
|
7
7
|
import './components/OrInput/OrInput.js';
|
|
8
8
|
import { BUTTON_COLOR } from './components/OrButtonV2/constants.js';
|
|
9
9
|
import { OrModalSizes } from './components/OrModal/constants.js';
|
|
10
|
-
import { s as script$2 } from './OrModal.vue_vue_type_script_lang-
|
|
10
|
+
import { s as script$2 } from './OrModal.vue_vue_type_script_lang-af0c4288.js';
|
|
11
11
|
import { s as script$3 } from './OrInput.vue_vue_type_script_lang-ad995b35.js';
|
|
12
12
|
|
|
13
13
|
var script = defineComponent({
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, onBeforeUnmount } from 'vue-demi';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { OrModalSizes } from './components/OrModal/constants.js';
|
|
4
|
+
import { onClickOutside } from '@vueuse/core';
|
|
5
|
+
import { u as useFocusTrap } from './useFocusTrap-9567b3c8.js';
|
|
6
|
+
import './components/OrIconButtonV2/OrIconButton.js';
|
|
7
|
+
import './components/OrOverlay/OrOverlay.js';
|
|
8
|
+
import { s as script$2 } from './OrOverlay.vue_vue_type_script_lang-2f5d626d.js';
|
|
9
|
+
import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-5d204461.js';
|
|
10
|
+
|
|
11
|
+
var script = defineComponent({
|
|
12
|
+
name: 'OrModal',
|
|
13
|
+
components: {
|
|
14
|
+
OrIconButton: script$1,
|
|
15
|
+
OrOverlay: script$2
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
titleText: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: false,
|
|
21
|
+
default: null,
|
|
22
|
+
validator: _.isString
|
|
23
|
+
},
|
|
24
|
+
showClose: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true,
|
|
27
|
+
validator: _.isBoolean
|
|
28
|
+
},
|
|
29
|
+
closeOnClickOutside: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: false,
|
|
32
|
+
default: false,
|
|
33
|
+
validator: _.isBoolean
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
default: OrModalSizes.small
|
|
39
|
+
},
|
|
40
|
+
isOpen: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
required: true,
|
|
43
|
+
validator: _.isBoolean
|
|
44
|
+
},
|
|
45
|
+
isWithoutOverlay: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: false,
|
|
48
|
+
default: false,
|
|
49
|
+
validator: _.isBoolean
|
|
50
|
+
},
|
|
51
|
+
trapFocus: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true,
|
|
54
|
+
validator: _.isBoolean
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
emits: ['close'],
|
|
58
|
+
setup(props, {
|
|
59
|
+
emit
|
|
60
|
+
}) {
|
|
61
|
+
const overlay = ref();
|
|
62
|
+
let container = ref(null);
|
|
63
|
+
let trap = useFocusTrap(container, {
|
|
64
|
+
immediate: props.trapFocus,
|
|
65
|
+
fallbackFocus: '.container',
|
|
66
|
+
allowOutsideClick: true
|
|
67
|
+
});
|
|
68
|
+
const handleClose = () => emit('close');
|
|
69
|
+
onClickOutside(container, evt => {
|
|
70
|
+
if (!evt.composedPath().includes(overlay.value.$el)) return;
|
|
71
|
+
if (props.closeOnClickOutside) handleClose();
|
|
72
|
+
});
|
|
73
|
+
const toggleFocusTrap = isNeedToTrap => {
|
|
74
|
+
if (isNeedToTrap && props.isOpen) {
|
|
75
|
+
trap.activate();
|
|
76
|
+
} else {
|
|
77
|
+
trap === null || trap === void 0 ? void 0 : trap.deactivate();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
watch(() => props.trapFocus, toggleFocusTrap, {
|
|
81
|
+
immediate: true
|
|
82
|
+
});
|
|
83
|
+
watch(() => props.isOpen, isOpen => {
|
|
84
|
+
toggleFocusTrap(false);
|
|
85
|
+
if (isOpen) {
|
|
86
|
+
container = ref(null);
|
|
87
|
+
} else {
|
|
88
|
+
trap === null || trap === void 0 ? void 0 : trap.deactivate();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
onBeforeUnmount(() => {
|
|
92
|
+
trap === null || trap === void 0 ? void 0 : trap.deactivate();
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
container,
|
|
96
|
+
overlay,
|
|
97
|
+
handleClose
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
computed: {
|
|
101
|
+
sizeClass() {
|
|
102
|
+
return `is-${this.size}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export { script as s };
|