@onereach/ui-components 2.68.0-beta.2002.0 → 2.68.0-beta.2008.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.
Files changed (37) hide show
  1. package/dist/bundled/v2/{OrCode-0cd991a1.js → OrCode-b9332066.js} +1 -1
  2. package/dist/bundled/v2/{OrConfirm-56d01cff.js → OrConfirm-19758dae.js} +1 -1
  3. package/dist/bundled/v2/OrModal-71d33219.js +202 -0
  4. package/dist/bundled/v2/{OrRichTextEditor-898d67d5.js → OrRichTextEditor-4a41e294.js} +14 -10
  5. package/dist/bundled/v2/components/index.js +5 -4
  6. package/dist/bundled/v2/components/or-code/index.js +3 -2
  7. package/dist/bundled/v2/components/or-confirm/index.js +3 -2
  8. package/dist/bundled/v2/components/or-modal/index.js +2 -1
  9. package/dist/bundled/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +5 -5
  10. package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +3 -2
  11. package/dist/bundled/v2/index.js +5 -4
  12. package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-a1ed2ebb.js → v2/useFocusTrap-d744652a.js} +4 -126
  13. package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-6c5f94a6.js → OrCode.vue_vue_type_script_lang-5fe573eb.js} +2 -2
  14. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-0f16fc67.js → OrConfirm.vue_vue_type_script_lang-4451e782.js} +2 -2
  15. package/dist/bundled/v3/{OrModal-868160ef.js → OrModal-bbabef06.js} +1 -1
  16. package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-a599dfe7.js +128 -0
  17. package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-2e607f79.js → OrRichTextEditor.vue_vue_type_script_lang-f5d3e39b.js} +13 -9
  18. package/dist/bundled/v3/components/index.js +6 -5
  19. package/dist/bundled/v3/components/or-code/index.js +4 -3
  20. package/dist/bundled/v3/components/or-confirm/index.js +4 -3
  21. package/dist/bundled/v3/components/or-modal/index.js +2 -1
  22. package/dist/bundled/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +5 -5
  23. package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +3 -2
  24. package/dist/bundled/v3/index.js +9 -8
  25. package/dist/bundled/{v2/OrModal-a5411b0d.js → v3/useFocusTrap-d21726e3.js} +3 -200
  26. package/dist/esm/v2/{OrRichTextEditor-6bc37dc4.js → OrRichTextEditor-11967cd9.js} +14 -10
  27. package/dist/esm/v2/components/index.js +1 -1
  28. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +5 -5
  29. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +2 -1
  30. package/dist/esm/v2/index.js +1 -1
  31. package/dist/esm/v3/{OrRichTextEditor-a5d38e89.js → OrRichTextEditor-ad5f24ba.js} +13 -9
  32. package/dist/esm/v3/components/index.js +1 -1
  33. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +5 -5
  34. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +2 -1
  35. package/dist/esm/v3/index.js +1 -1
  36. package/package.json +1 -1
  37. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +17 -11
@@ -1,20 +1,5 @@
1
- import './index-fa6eb4ca.js';
2
- import _ from 'lodash';
3
- import { unrefElement, tryOnScopeDispose, onClickOutside } from '@vueuse/core';
4
- import { ref, watch, defineComponent, onBeforeUnmount } from '@vue/composition-api/dist/vue-composition-api.mjs';
5
- import { O as OrIconButton } from './OrIconButton-65962c1c.js';
6
- import { O as OrOverlay } from './OrOverlay-47967a8b.js';
7
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
8
- import { c as createInjector } from './browser-82dea9ed.js';
9
-
10
- var OrModalSizes;
11
- (function (OrModalSizes) {
12
- OrModalSizes["tiny"] = "tiny";
13
- OrModalSizes["small"] = "small";
14
- OrModalSizes["medium"] = "medium";
15
- OrModalSizes["large"] = "large";
16
- OrModalSizes["fullScreen"] = "fullScreen";
17
- })(OrModalSizes || (OrModalSizes = {}));
1
+ import { unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
+ import { ref, watch } from 'vue';
18
3
 
19
4
  /*!
20
5
  * tabbable 6.0.1
@@ -1280,186 +1265,4 @@ function useFocusTrap(target, options = {}) {
1280
1265
  };
1281
1266
  }
1282
1267
 
1283
- var script = defineComponent({
1284
- name: 'OrModal',
1285
- components: {
1286
- OrIconButton,
1287
- OrOverlay
1288
- },
1289
- props: {
1290
- titleText: {
1291
- type: String,
1292
- required: false,
1293
- default: null,
1294
- validator: _.isString
1295
- },
1296
- showClose: {
1297
- type: Boolean,
1298
- default: true,
1299
- validator: _.isBoolean
1300
- },
1301
- closeOnClickOutside: {
1302
- type: Boolean,
1303
- required: false,
1304
- default: false,
1305
- validator: _.isBoolean
1306
- },
1307
- size: {
1308
- type: String,
1309
- required: false,
1310
- default: OrModalSizes.small
1311
- },
1312
- isOpen: {
1313
- type: Boolean,
1314
- required: true,
1315
- validator: _.isBoolean
1316
- },
1317
- isWithoutOverlay: {
1318
- type: Boolean,
1319
- required: false,
1320
- default: false,
1321
- validator: _.isBoolean
1322
- },
1323
- trapFocus: {
1324
- type: Boolean,
1325
- default: true,
1326
- validator: _.isBoolean
1327
- }
1328
- },
1329
- emits: ['close'],
1330
- setup(props, {
1331
- emit
1332
- }) {
1333
- const overlay = ref();
1334
- let container = ref(null);
1335
- let trap = useFocusTrap(container, {
1336
- immediate: props.trapFocus,
1337
- fallbackFocus: '.container',
1338
- allowOutsideClick: true
1339
- });
1340
- const handleClose = () => emit('close');
1341
- onClickOutside(container, evt => {
1342
- if (!evt.composedPath().includes(overlay.value.$el)) return;
1343
- if (props.closeOnClickOutside) handleClose();
1344
- });
1345
- const toggleFocusTrap = isNeedToTrap => {
1346
- if (isNeedToTrap && props.isOpen) {
1347
- trap.activate();
1348
- } else {
1349
- trap === null || trap === void 0 ? void 0 : trap.deactivate();
1350
- }
1351
- };
1352
- watch(() => props.trapFocus, toggleFocusTrap, {
1353
- immediate: true
1354
- });
1355
- watch(() => props.isOpen, isOpen => {
1356
- toggleFocusTrap(false);
1357
- if (isOpen) {
1358
- container = ref(null);
1359
- } else {
1360
- trap === null || trap === void 0 ? void 0 : trap.deactivate();
1361
- }
1362
- });
1363
- onBeforeUnmount(() => {
1364
- trap === null || trap === void 0 ? void 0 : trap.deactivate();
1365
- });
1366
- return {
1367
- container,
1368
- overlay,
1369
- handleClose
1370
- };
1371
- },
1372
- computed: {
1373
- sizeClass() {
1374
- return `is-${this.size}`;
1375
- }
1376
- }
1377
- });
1378
-
1379
- /* script */
1380
- const __vue_script__ = script;
1381
-
1382
- /* template */
1383
- var __vue_render__ = function () {
1384
- var _vm = this;
1385
- var _h = _vm.$createElement;
1386
- var _c = _vm._self._c || _h;
1387
- return _vm.isOpen ? _c('div', {
1388
- staticClass: "or-modal"
1389
- }, [_c('or-overlay', {
1390
- ref: "overlay",
1391
- attrs: {
1392
- "is-active": "",
1393
- "is-without-background": _vm.isWithoutOverlay
1394
- }
1395
- }, [_c('div', {
1396
- ref: "container",
1397
- class: [_vm.sizeClass, 'container', {
1398
- 'is-without-overlay': _vm.isWithoutOverlay
1399
- }]
1400
- }, [_vm._t("header", function () {
1401
- return [_c('div', {
1402
- staticClass: "header"
1403
- }, [_vm._t("title", function () {
1404
- return [_c('div', {
1405
- staticClass: "title"
1406
- }, [_vm._v("\n " + _vm._s(_vm.titleText) + "\n ")])];
1407
- }), _vm._v(" "), _c('or-icon-button', {
1408
- directives: [{
1409
- name: "show",
1410
- rawName: "v-show",
1411
- value: _vm.showClose,
1412
- expression: "showClose"
1413
- }],
1414
- attrs: {
1415
- "icon": "close",
1416
- "icon-color": "neutral-6"
1417
- },
1418
- on: {
1419
- "click": _vm.handleClose
1420
- }
1421
- })], 2)];
1422
- }), _vm._v(" "), _vm._t("content", function () {
1423
- return [_c('div', {
1424
- staticClass: "content"
1425
- }, [_vm._t("default")], 2)];
1426
- }), _vm._v(" "), _c('div', {
1427
- directives: [{
1428
- name: "show",
1429
- rawName: "v-show",
1430
- value: _vm.$slots.footer,
1431
- expression: "$slots.footer"
1432
- }],
1433
- staticClass: "footer"
1434
- }, [_vm._t("footer", null, {
1435
- "close": _vm.handleClose
1436
- })], 2)], 2)])], 1) : _vm._e();
1437
- };
1438
- var __vue_staticRenderFns__ = [];
1439
-
1440
- /* style */
1441
- const __vue_inject_styles__ = function (inject) {
1442
- if (!inject) return;
1443
- inject("data-v-1caff449_0", {
1444
- source: "@keyframes spinAround-data-v-1caff449{from{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes fade-data-v-1caff449{from{opacity:1}to{opacity:0}}.or-modal[data-v-1caff449]{position:fixed;top:0;left:0;z-index:50;width:100%;height:100%}.or-modal .or-overlay[data-v-1caff449]{align-items:center;justify-content:center}.or-modal .container[data-v-1caff449]{position:absolute;display:flex;flex-flow:column;max-width:100%;max-height:80%;background-color:var(--c-neutral-0);border-radius:var(--s-2);outline:0}.or-modal .container.is-without-overlay[data-v-1caff449]{box-shadow:0 .125rem .5rem 0 rgba(0,0,0,.1)}.or-modal .container.is-fullScreen[data-v-1caff449]{width:calc(100% - var(--s-7));height:calc(100% - var(--s-7));max-height:calc(100% - var(--s-7));margin:0 auto}.or-modal .container.is-tiny[data-v-1caff449]{width:320px}.or-modal .container.is-small[data-v-1caff449]{width:480px}.or-modal .container.is-medium[data-v-1caff449]{width:700px}.or-modal .container.is-large[data-v-1caff449]{width:1049px}.or-modal .container .header[data-v-1caff449]{display:flex;justify-content:space-between;padding:24px 24px 20px 24px;border-radius:var(--s-2) var(--s-2) 0 0}.or-modal .container .header .title[data-v-1caff449]{font-size:1.125rem;font-weight:700}.or-modal .container .content[data-v-1caff449]{flex-grow:1;padding:0 24px 24px 24px;overflow:auto}.or-modal .container .footer[data-v-1caff449]{padding:16px 24px 24px 24px;border-radius:0 0 var(--s-2) var(--s-2);box-shadow:0 -3px 4px 0 rgba(0,0,0,.08)}",
1445
- map: undefined,
1446
- media: undefined
1447
- });
1448
- };
1449
- /* scoped */
1450
- const __vue_scope_id__ = "data-v-1caff449";
1451
- /* module identifier */
1452
- const __vue_module_identifier__ = undefined;
1453
- /* functional template */
1454
- const __vue_is_functional_template__ = false;
1455
- /* style inject SSR */
1456
-
1457
- /* style inject shadow dom */
1458
-
1459
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
1460
- render: __vue_render__,
1461
- staticRenderFns: __vue_staticRenderFns__
1462
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, createInjector, undefined, undefined);
1463
- var OrModal = __vue_component__;
1464
-
1465
- export { OrModal as O, OrModalSizes as a };
1268
+ export { useFocusTrap as u };
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
2
2
  import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
3
3
  import '@vueuse/core';
4
+ import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
4
5
  import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
5
6
  import { DOMParser as DOMParser$1 } from 'prosemirror-model';
6
7
  import { marked } from 'marked';
@@ -87,7 +88,7 @@ var script = defineComponent({
87
88
  },
88
89
  description: {
89
90
  type: String,
90
- default: 'Description'
91
+ default: ''
91
92
  },
92
93
  placeholder: {
93
94
  type: String,
@@ -97,7 +98,7 @@ var script = defineComponent({
97
98
  type: Boolean,
98
99
  default: false
99
100
  },
100
- markdown: {
101
+ markdownFormat: {
101
102
  type: Boolean,
102
103
  default: true
103
104
  }
@@ -117,6 +118,11 @@ var script = defineComponent({
117
118
  const previousHeadingLevel = ref();
118
119
  const activeHeadingLevel = ref(0);
119
120
  const markdownOutput = ref('');
121
+ let trap = useFocusTrap(editorRef, {
122
+ immediate: true,
123
+ fallbackFocus: '.container',
124
+ allowOutsideClick: true
125
+ });
120
126
  const iconsEnum = ref({
121
127
  bold: 'format_bold',
122
128
  italic: 'format_italic',
@@ -188,7 +194,7 @@ var script = defineComponent({
188
194
  setActiveFormats();
189
195
  const html = editor.getHTML();
190
196
  const text = editor.getText();
191
- if (props.markdown) {
197
+ if (props.markdownFormat) {
192
198
  markdownOutput.value = serialize(editor.schema, editor.getJSON());
193
199
  emit('update:modelValue', markdownOutput.value);
194
200
  } else {
@@ -198,10 +204,8 @@ var script = defineComponent({
198
204
  onCreate: ({
199
205
  editor
200
206
  }) => {
201
- if (props.markdown) {
207
+ if (props.markdownFormat) {
202
208
  const deserialized = deserialize(editor.schema, props.modelValue);
203
- // const deserialized = defaultMarkdownParser.parse(props.modelValue);
204
- // editor.view.state.doc = deserialized as Node;
205
209
  editor.commands.setContent(deserialized);
206
210
  } else {
207
211
  editor.commands.setContent(props.modelValue);
@@ -247,6 +251,7 @@ var script = defineComponent({
247
251
  onBeforeUnmount(() => {
248
252
  editor === null || editor === void 0 ? void 0 : editor.destroy();
249
253
  });
254
+ trap.activate();
250
255
  // Computed
251
256
  const getIndexOfHeading = computed(() => {
252
257
  return props.toolbar.flat().indexOf('heading');
@@ -348,7 +353,6 @@ var script = defineComponent({
348
353
  return serializer.serialize(proseMirrorDocument);
349
354
  };
350
355
  const deserialize = (schema, content) => {
351
- // const html = defaultMarkdownParser.parse(content);
352
356
  const html = marked.parse(content);
353
357
  if (!html) return null;
354
358
  const parser = new DOMParser();
@@ -362,10 +366,10 @@ var script = defineComponent({
362
366
  };
363
367
  //Effects
364
368
  watch(() => props.modelValue, value => {
365
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdown) {
369
+ if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdownFormat) {
366
370
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
367
371
  }
368
- if (props.markdown && value !== markdownOutput.value) {
372
+ if (props.markdownFormat && value !== markdownOutput.value) {
369
373
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(markdownOutput.value);
370
374
  }
371
375
  });
@@ -492,7 +496,7 @@ var __vue_staticRenderFns__ = [];
492
496
  /* style */
493
497
  const __vue_inject_styles__ = function (inject) {
494
498
  if (!inject) return;
495
- inject("data-v-23c7ff28_0", {
499
+ inject("data-v-2c13389b_0", {
496
500
  source: ".tiptap-editor ol{margin:0 24px;list-style:decimal}.tiptap-editor ul{margin:0 24px;list-style:initial}.tiptap-editor .is-editor-empty::before{content:attr(data-placeholder);height:0;pointer-events:none;float:left}",
497
501
  map: undefined,
498
502
  media: undefined
@@ -95,7 +95,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665
95
95
  export { _ as OrTooltip } from '../OrTooltip-614b016d.js';
96
96
  export { _ as OrTooltipContent } from '../OrTooltip.vue_rollup-plugin-vue_script-63559536.js';
97
97
  export { _ as OrTooltipV3 } from '../OrTooltip-3454c2e6.js';
98
- export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-6bc37dc4.js';
98
+ export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-11967cd9.js';
99
99
  import 'vue-demi';
100
100
  import 'lodash';
101
101
  import '../normalize-component-6e8e3d80.js';
@@ -56,7 +56,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
56
56
  type: BooleanConstructor;
57
57
  default: boolean;
58
58
  };
59
- markdown: {
59
+ markdownFormat: {
60
60
  type: BooleanConstructor;
61
61
  default: boolean;
62
62
  };
@@ -82,7 +82,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
82
82
  type: BooleanConstructor;
83
83
  default: boolean;
84
84
  };
85
- markdown: {
85
+ markdownFormat: {
86
86
  type: BooleanConstructor;
87
87
  default: boolean;
88
88
  };
@@ -92,7 +92,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
92
92
  description: string;
93
93
  placeholder: string;
94
94
  autofocus: boolean;
95
- markdown: boolean;
95
+ markdownFormat: boolean;
96
96
  } & {} & {
97
97
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
98
98
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -135,7 +135,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
135
135
  description: string;
136
136
  placeholder: string;
137
137
  autofocus: boolean;
138
- markdown: boolean;
138
+ markdownFormat: boolean;
139
139
  } & {} & {
140
140
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
141
141
  }, {
@@ -144,6 +144,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
144
144
  description: string;
145
145
  placeholder: string;
146
146
  autofocus: boolean;
147
- markdown: boolean;
147
+ markdownFormat: boolean;
148
148
  }, true>);
149
149
  export default _default;
@@ -1,7 +1,8 @@
1
- export { _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-6bc37dc4.js';
1
+ export { _ as OrRichTextEditorV3 } from '../../OrRichTextEditor-11967cd9.js';
2
2
  import 'vue-demi';
3
3
  import '../../useClassAttribute-47fdb016.js';
4
4
  import '@vueuse/core';
5
+ import '@vueuse/integrations/useFocusTrap';
5
6
  import 'prosemirror-markdown';
6
7
  import 'prosemirror-model';
7
8
  import 'marked';
@@ -95,7 +95,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-06654
95
95
  export { _ as OrTooltip } from './OrTooltip-614b016d.js';
96
96
  export { _ as OrTooltipContent } from './OrTooltip.vue_rollup-plugin-vue_script-63559536.js';
97
97
  export { _ as OrTooltipV3 } from './OrTooltip-3454c2e6.js';
98
- export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-6bc37dc4.js';
98
+ export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-11967cd9.js';
99
99
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
100
100
  export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
101
101
  export { u as useElevation } from './useElevation-31bfe1f6.js';
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
2
2
  import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
3
3
  import '@vueuse/core';
4
+ import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
4
5
  import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
5
6
  import { DOMParser as DOMParser$1 } from 'prosemirror-model';
6
7
  import { marked } from 'marked';
@@ -87,7 +88,7 @@ var script = defineComponent({
87
88
  },
88
89
  description: {
89
90
  type: String,
90
- default: 'Description'
91
+ default: ''
91
92
  },
92
93
  placeholder: {
93
94
  type: String,
@@ -97,7 +98,7 @@ var script = defineComponent({
97
98
  type: Boolean,
98
99
  default: false
99
100
  },
100
- markdown: {
101
+ markdownFormat: {
101
102
  type: Boolean,
102
103
  default: true
103
104
  }
@@ -117,6 +118,11 @@ var script = defineComponent({
117
118
  const previousHeadingLevel = ref();
118
119
  const activeHeadingLevel = ref(0);
119
120
  const markdownOutput = ref('');
121
+ let trap = useFocusTrap(editorRef, {
122
+ immediate: true,
123
+ fallbackFocus: '.container',
124
+ allowOutsideClick: true
125
+ });
120
126
  const iconsEnum = ref({
121
127
  bold: 'format_bold',
122
128
  italic: 'format_italic',
@@ -188,7 +194,7 @@ var script = defineComponent({
188
194
  setActiveFormats();
189
195
  const html = editor.getHTML();
190
196
  const text = editor.getText();
191
- if (props.markdown) {
197
+ if (props.markdownFormat) {
192
198
  markdownOutput.value = serialize(editor.schema, editor.getJSON());
193
199
  emit('update:modelValue', markdownOutput.value);
194
200
  } else {
@@ -198,10 +204,8 @@ var script = defineComponent({
198
204
  onCreate: ({
199
205
  editor
200
206
  }) => {
201
- if (props.markdown) {
207
+ if (props.markdownFormat) {
202
208
  const deserialized = deserialize(editor.schema, props.modelValue);
203
- // const deserialized = defaultMarkdownParser.parse(props.modelValue);
204
- // editor.view.state.doc = deserialized as Node;
205
209
  editor.commands.setContent(deserialized);
206
210
  } else {
207
211
  editor.commands.setContent(props.modelValue);
@@ -247,6 +251,7 @@ var script = defineComponent({
247
251
  onBeforeUnmount(() => {
248
252
  editor === null || editor === void 0 ? void 0 : editor.destroy();
249
253
  });
254
+ trap.activate();
250
255
  // Computed
251
256
  const getIndexOfHeading = computed(() => {
252
257
  return props.toolbar.flat().indexOf('heading');
@@ -348,7 +353,6 @@ var script = defineComponent({
348
353
  return serializer.serialize(proseMirrorDocument);
349
354
  };
350
355
  const deserialize = (schema, content) => {
351
- // const html = defaultMarkdownParser.parse(content);
352
356
  const html = marked.parse(content);
353
357
  if (!html) return null;
354
358
  const parser = new DOMParser();
@@ -362,10 +366,10 @@ var script = defineComponent({
362
366
  };
363
367
  //Effects
364
368
  watch(() => props.modelValue, value => {
365
- if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdown) {
369
+ if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && !props.markdownFormat) {
366
370
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
367
371
  }
368
- if (props.markdown && value !== markdownOutput.value) {
372
+ if (props.markdownFormat && value !== markdownOutput.value) {
369
373
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(markdownOutput.value);
370
374
  }
371
375
  });
@@ -89,7 +89,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from '../types-
89
89
  export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665462d.js';
90
90
  export { s as OrTooltip, a as OrTooltipContent } from '../OrTooltip-78cd7f6b.js';
91
91
  export { s as OrTooltipV3 } from '../OrTooltip-1500a1cd.js';
92
- export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-a5d38e89.js';
92
+ export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-ad5f24ba.js';
93
93
  import 'vue-demi';
94
94
  import 'lodash';
95
95
  import 'vue';
@@ -56,7 +56,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
56
56
  type: BooleanConstructor;
57
57
  default: boolean;
58
58
  };
59
- markdown: {
59
+ markdownFormat: {
60
60
  type: BooleanConstructor;
61
61
  default: boolean;
62
62
  };
@@ -82,7 +82,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
82
82
  type: BooleanConstructor;
83
83
  default: boolean;
84
84
  };
85
- markdown: {
85
+ markdownFormat: {
86
86
  type: BooleanConstructor;
87
87
  default: boolean;
88
88
  };
@@ -92,7 +92,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
92
92
  description: string;
93
93
  placeholder: string;
94
94
  autofocus: boolean;
95
- markdown: boolean;
95
+ markdownFormat: boolean;
96
96
  } & {} & {
97
97
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
98
98
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -135,7 +135,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
135
135
  description: string;
136
136
  placeholder: string;
137
137
  autofocus: boolean;
138
- markdown: boolean;
138
+ markdownFormat: boolean;
139
139
  } & {} & {
140
140
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
141
141
  }, {
@@ -144,6 +144,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
144
144
  description: string;
145
145
  placeholder: string;
146
146
  autofocus: boolean;
147
- markdown: boolean;
147
+ markdownFormat: boolean;
148
148
  }, true>);
149
149
  export default _default;
@@ -1,7 +1,8 @@
1
- export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-a5d38e89.js';
1
+ export { s as OrRichTextEditorV3 } from '../../OrRichTextEditor-ad5f24ba.js';
2
2
  import 'vue-demi';
3
3
  import '../../useClassAttribute-47fdb016.js';
4
4
  import '@vueuse/core';
5
+ import '@vueuse/integrations/useFocusTrap';
5
6
  import 'prosemirror-markdown';
6
7
  import 'prosemirror-model';
7
8
  import 'marked';
@@ -89,7 +89,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from './types-9
89
89
  export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-0665462d.js';
90
90
  export { s as OrTooltip, a as OrTooltipContent } from './OrTooltip-78cd7f6b.js';
91
91
  export { s as OrTooltipV3 } from './OrTooltip-1500a1cd.js';
92
- export { s as OrRichTextEditorV3 } from './OrRichTextEditor-a5d38e89.js';
92
+ export { s as OrRichTextEditorV3 } from './OrRichTextEditor-ad5f24ba.js';
93
93
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
94
94
  export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
95
95
  export { u as useElevation } from './useElevation-31bfe1f6.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.68.0-beta.2002.0",
3
+ "version": "2.68.0-beta.2008.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -70,16 +70,20 @@
70
70
  <script lang="ts">
71
71
  import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
72
72
  import { useClassAttribute } from '../../hooks';
73
+ import { useFocusTrap, UseFocusTrapReturn } from '@vueuse/integrations/useFocusTrap';
74
+
73
75
  import {
74
76
  MarkdownSerializer as ProseMirrorMarkdownSerializer,
75
77
  defaultMarkdownSerializer,
76
78
  } from 'prosemirror-markdown';
77
79
  import { DOMParser as ProseMirrorDOMParser, Node, Mark } from 'prosemirror-model';
78
80
  import { marked } from 'marked';
81
+
79
82
  import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
80
83
  import { OrLabelV3 as OrLabel } from '../or-label-v3';
81
84
  import { OrMenuV3 as OrMenu } from '../or-menu-v3';
82
85
  import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
86
+
83
87
  import {
84
88
  EditorContainer,
85
89
  ToolbarContainer,
@@ -129,7 +133,7 @@ export default defineComponent({
129
133
  },
130
134
  description: {
131
135
  type: String,
132
- default: 'Description',
136
+ default: '',
133
137
  },
134
138
  placeholder: {
135
139
  type: String,
@@ -139,7 +143,7 @@ export default defineComponent({
139
143
  type: Boolean,
140
144
  default: false,
141
145
  },
142
- markdown: {
146
+ markdownFormat: {
143
147
  type: Boolean,
144
148
  default: true,
145
149
  },
@@ -159,6 +163,11 @@ export default defineComponent({
159
163
  const previousHeadingLevel = ref<Level>();
160
164
  const activeHeadingLevel = ref<number>(0);
161
165
  const markdownOutput = ref<string>('');
166
+ let trap: UseFocusTrapReturn = useFocusTrap(editorRef, {
167
+ immediate: true,
168
+ fallbackFocus: '.container',
169
+ allowOutsideClick: true,
170
+ });
162
171
  const iconsEnum = ref<{[key: string]: string;}>({
163
172
  bold: 'format_bold',
164
173
  italic: 'format_italic',
@@ -171,7 +180,6 @@ export default defineComponent({
171
180
  redo: 'redo',
172
181
  undo: 'undo',
173
182
  });
174
-
175
183
  const iconTooltipsEnum = ref<{[key: string]: string;}>({
176
184
  bold: 'Bold',
177
185
  italic: 'Italic',
@@ -220,7 +228,6 @@ export default defineComponent({
220
228
  })`;
221
229
  },
222
230
  },
223
-
224
231
  };
225
232
 
226
233
  const serializerNodes = {
@@ -238,7 +245,7 @@ export default defineComponent({
238
245
  setActiveFormats();
239
246
  const html = editor.getHTML();
240
247
  const text = editor.getText();
241
- if (props.markdown) {
248
+ if (props.markdownFormat) {
242
249
  markdownOutput.value = serialize(editor.schema, editor.getJSON());
243
250
  emit('update:modelValue', markdownOutput.value);
244
251
  } else {
@@ -246,10 +253,8 @@ export default defineComponent({
246
253
  }
247
254
  },
248
255
  onCreate: ({ editor }) => {
249
- if (props.markdown) {
256
+ if (props.markdownFormat) {
250
257
  const deserialized = deserialize(editor.schema, props.modelValue);
251
- // const deserialized = defaultMarkdownParser.parse(props.modelValue);
252
- // editor.view.state.doc = deserialized as Node;
253
258
  editor.commands.setContent(deserialized);
254
259
  } else {
255
260
  editor.commands.setContent(props.modelValue);
@@ -304,6 +309,8 @@ export default defineComponent({
304
309
  editor?.destroy();
305
310
  });
306
311
 
312
+ trap.activate();
313
+
307
314
  // Computed
308
315
  const getIndexOfHeading = computed(() => {
309
316
  return props.toolbar.flat().indexOf('heading');
@@ -448,7 +455,6 @@ export default defineComponent({
448
455
  };
449
456
 
450
457
  const deserialize = (schema: any, content: any) => {
451
- // const html = defaultMarkdownParser.parse(content);
452
458
  const html = marked.parse(content);
453
459
 
454
460
  if (!html) return null;
@@ -465,10 +471,10 @@ export default defineComponent({
465
471
 
466
472
  //Effects
467
473
  watch(() => props.modelValue, (value) => {
468
- if (value !== editor?.getHTML() && !props.markdown) {
474
+ if (value !== editor?.getHTML() && !props.markdownFormat) {
469
475
  editor?.commands.setContent(value);
470
476
  }
471
- if (props.markdown && value !== markdownOutput.value) {
477
+ if (props.markdownFormat && value !== markdownOutput.value) {
472
478
  editor?.commands.setContent(markdownOutput.value);
473
479
  }
474
480
  });