diff --git a/dist/js/field.js b/dist/js/field.js index 28406ff..e5f135d 100644 --- a/dist/js/field.js +++ b/dist/js/field.js @@ -5961,7 +5961,8 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length) editable: !this.field.readonly, editorProps: { attributes: { - "class": 'nova-canvas-content h-auto min-h-40 max-w-none block py-3 prose prose-slate form-control form-input form-input--bottom form-control-bordered dark:prose-invert prose-sm focus:outline-none' + "class": 'nova-canvas-content h-auto overflow-y-scroll min-h-40 max-w-none block py-3 prose prose-slate form-control form-input form-input--bottom form-control-bordered dark:prose-invert prose-sm focus:outline-none', + style: this.field.scrollable ? "height: ".concat(this.field.scrollable, "px;") : '' } }, content: this.value, @@ -6410,6 +6411,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { var _component_EyeIcon = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("EyeIcon"); var _component_EditorContent = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("EditorContent"); var _component_DefaultField = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DefaultField"); + var _directive_sticky = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("sticky"); return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_DefaultField, { field: $props.field, errors: _ctx.errors, @@ -6419,16 +6421,17 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { field: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () { return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", { ref: "container", + "sticky-container": "", "class": (0,vue__WEBPACK_IMPORTED_MODULE_0__.normalizeClass)(["nova-canvas", { 'nova-canvas--disabled': !$options.editorReady }]) - }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_1, [$options.editorReady ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_FixedMenu, { + }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("div", _hoisted_1, [$options.editorReady ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_FixedMenu, { key: 0, editor: $data.editor, field: $props.field }, null, 8 /* PROPS */, ["editor", "field"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)("span", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_EyeIcon, { "class": "h-4 w-4 inline mr-2" - }), _cache[1] || (_cache[1] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Read-only mode "))]))], 512 /* NEED_PATCH */), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_EditorContent, { + }), _cache[1] || (_cache[1] = (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Read-only mode "))]))])), [[_directive_sticky]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_EditorContent, { editor: $data.editor, modelValue: _ctx.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { @@ -6753,6 +6756,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _components_IndexField__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/IndexField */ "./resources/js/components/IndexField.vue"); /* harmony import */ var _components_DetailField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/DetailField */ "./resources/js/components/DetailField.vue"); /* harmony import */ var _components_FormField__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/FormField */ "./resources/js/components/FormField.vue"); +/* harmony import */ var vue3_sticky_directive__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue3-sticky-directive */ "./node_modules/vue3-sticky-directive/dist/index.js"); + @@ -6760,6 +6765,7 @@ Nova.booting(function (app, store) { app.component('index-nova-editor', _components_IndexField__WEBPACK_IMPORTED_MODULE_0__["default"]); app.component('detail-nova-editor', _components_DetailField__WEBPACK_IMPORTED_MODULE_1__["default"]); app.component('form-nova-editor', _components_FormField__WEBPACK_IMPORTED_MODULE_2__["default"]); + app.use(vue3_sticky_directive__WEBPACK_IMPORTED_MODULE_3__["default"]); }); /***/ }), @@ -7726,14 +7732,15 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e _this3.canceller = canceller; }) }).then(function (response) { - var previousValue = _this3.currentField.value; + var snapshot = JSON.parse(JSON.stringify(_this3.currentField)); var wasVisible = _this3.currentlyIsVisible; _this3.syncedField = response.data; if (_this3.syncedField.visible !== wasVisible) { _this3.$emit(_this3.syncedField.visible === true ? 'field-shown' : 'field-hidden', _this3.fieldAttribute); } if (lodash_isNil__WEBPACK_IMPORTED_MODULE_5___default()(_this3.syncedField.value)) { - _this3.syncedField.value = previousValue; + _this3.syncedField.value = snapshot.value; + _this3.revertSyncedFieldToPreviousValue(snapshot); } else { _this3.setInitialValue(); } @@ -7749,6 +7756,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e throw e; }); }, + revertSyncedFieldToPreviousValue: function revertSyncedFieldToPreviousValue(field) { + // + }, onSyncedField: function onSyncedField() { // }, @@ -16245,13 +16255,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _DetailField_vue_vue_type_template_id_0224618e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DetailField.vue?vue&type=template&id=0224618e */ "./resources/js/components/DetailField.vue?vue&type=template&id=0224618e"); /* harmony import */ var _DetailField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DetailField.vue?vue&type=script&lang=js */ "./resources/js/components/DetailField.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_DetailField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_DetailField_vue_vue_type_template_id_0224618e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/DetailField.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_DetailField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_DetailField_vue_vue_type_template_id_0224618e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/DetailField.vue"]]) /* hot reload */ if (false) {} @@ -16273,13 +16283,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _FormField_vue_vue_type_template_id_c023248a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FormField.vue?vue&type=template&id=c023248a */ "./resources/js/components/FormField.vue?vue&type=template&id=c023248a"); /* harmony import */ var _FormField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FormField.vue?vue&type=script&lang=js */ "./resources/js/components/FormField.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_FormField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_FormField_vue_vue_type_template_id_c023248a__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/FormField.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_FormField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_FormField_vue_vue_type_template_id_c023248a__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/FormField.vue"]]) /* hot reload */ if (false) {} @@ -16301,13 +16311,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _IndexField_vue_vue_type_template_id_9e63f81a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IndexField.vue?vue&type=template&id=9e63f81a */ "./resources/js/components/IndexField.vue?vue&type=template&id=9e63f81a"); /* harmony import */ var _IndexField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IndexField.vue?vue&type=script&lang=js */ "./resources/js/components/IndexField.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_IndexField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_IndexField_vue_vue_type_template_id_9e63f81a__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/IndexField.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_IndexField_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_IndexField_vue_vue_type_template_id_9e63f81a__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/IndexField.vue"]]) /* hot reload */ if (false) {} @@ -16329,13 +16339,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _FixedMenu_vue_vue_type_template_id_8a14fc46__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FixedMenu.vue?vue&type=template&id=8a14fc46 */ "./resources/js/components/Menus/FixedMenu.vue?vue&type=template&id=8a14fc46"); /* harmony import */ var _FixedMenu_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FixedMenu.vue?vue&type=script&lang=js */ "./resources/js/components/Menus/FixedMenu.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_FixedMenu_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_FixedMenu_vue_vue_type_template_id_8a14fc46__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Menus/FixedMenu.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_FixedMenu_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_FixedMenu_vue_vue_type_template_id_8a14fc46__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Menus/FixedMenu.vue"]]) /* hot reload */ if (false) {} @@ -16357,13 +16367,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _InsertLink_vue_vue_type_template_id_911d703e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./InsertLink.vue?vue&type=template&id=911d703e */ "./resources/js/components/Modals/InsertLink.vue?vue&type=template&id=911d703e"); /* harmony import */ var _InsertLink_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InsertLink.vue?vue&type=script&lang=js */ "./resources/js/components/Modals/InsertLink.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_InsertLink_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_InsertLink_vue_vue_type_template_id_911d703e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Modals/InsertLink.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_InsertLink_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_InsertLink_vue_vue_type_template_id_911d703e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Modals/InsertLink.vue"]]) /* hot reload */ if (false) {} @@ -16385,13 +16395,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _Format_vue_vue_type_template_id_7a615536__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Format.vue?vue&type=template&id=7a615536 */ "./resources/js/components/Tools/Format.vue?vue&type=template&id=7a615536"); /* harmony import */ var _Format_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Format.vue?vue&type=script&lang=js */ "./resources/js/components/Tools/Format.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Format_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Format_vue_vue_type_template_id_7a615536__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Format.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Format_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Format_vue_vue_type_template_id_7a615536__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Format.vue"]]) /* hot reload */ if (false) {} @@ -16413,13 +16423,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _Link_vue_vue_type_template_id_93ec9d0e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Link.vue?vue&type=template&id=93ec9d0e */ "./resources/js/components/Tools/Link.vue?vue&type=template&id=93ec9d0e"); /* harmony import */ var _Link_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Link.vue?vue&type=script&lang=js */ "./resources/js/components/Tools/Link.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Link_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Link_vue_vue_type_template_id_93ec9d0e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Link.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Link_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Link_vue_vue_type_template_id_93ec9d0e__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Link.vue"]]) /* hot reload */ if (false) {} @@ -16440,12 +16450,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Separator_vue_vue_type_template_id_44cd1776__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Separator.vue?vue&type=template&id=44cd1776 */ "./resources/js/components/Tools/Separator.vue?vue&type=template&id=44cd1776"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); const script = {} ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__["default"])(script, [['render',_Separator_vue_vue_type_template_id_44cd1776__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Separator.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_1__["default"])(script, [['render',_Separator_vue_vue_type_template_id_44cd1776__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Separator.vue"]]) /* hot reload */ if (false) {} @@ -16467,13 +16477,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var _Standard_vue_vue_type_template_id_668a8988__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Standard.vue?vue&type=template&id=668a8988 */ "./resources/js/components/Tools/Standard.vue?vue&type=template&id=668a8988"); /* harmony import */ var _Standard_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Standard.vue?vue&type=script&lang=js */ "./resources/js/components/Tools/Standard.vue?vue&type=script&lang=js"); -/* harmony import */ var _Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); +/* harmony import */ var _Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/vue-loader/dist/exportHelper.js */ "./node_modules/vue-loader/dist/exportHelper.js"); ; -const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_pest_expert_shop_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Standard_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Standard_vue_vue_type_template_id_668a8988__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Standard.vue"]]) +const __exports__ = /*#__PURE__*/(0,_Users_jacobfitzpatrick_projects_jacobfitzp_nova_components_NovaCanvas_node_modules_vue_loader_dist_exportHelper_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_Standard_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__["default"], [['render',_Standard_vue_vue_type_template_id_668a8988__WEBPACK_IMPORTED_MODULE_0__.render],['__file',"resources/js/components/Tools/Standard.vue"]]) /* hot reload */ if (false) {} @@ -33522,20 +33532,24 @@ var isArray = Array.isArray; var defaults = { allowDots: false, + allowEmptyArrays: false, allowPrototypes: false, allowSparse: false, arrayLimit: 20, charset: 'utf-8', charsetSentinel: false, comma: false, + decodeDotInKeys: false, decoder: utils.decode, delimiter: '&', depth: 5, + duplicates: 'combine', ignoreQueryPrefix: false, interpretNumericEntities: false, parameterLimit: 1000, parseArrays: true, plainObjects: false, + strictDepth: false, strictNullHandling: false }; @@ -33567,6 +33581,7 @@ var parseValues = function parseQueryStringValues(str, options) { var obj = { __proto__: null }; var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']'); var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; var parts = cleanStr.split(options.delimiter, limit); var skipIndex = -1; // Keep track of where the utf8 sentinel was found @@ -33618,9 +33633,10 @@ var parseValues = function parseQueryStringValues(str, options) { val = isArray(val) ? [val] : val; } - if (has.call(obj, key)) { + var existing = has.call(obj, key); + if (existing && options.duplicates === 'combine') { obj[key] = utils.combine(obj[key], val); - } else { + } else if (!existing || options.duplicates === 'last') { obj[key] = val; } } @@ -33636,24 +33652,27 @@ var parseObject = function (chain, val, options, valuesParsed) { var root = chain[i]; if (root === '[]' && options.parseArrays) { - obj = [].concat(leaf); + obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null)) + ? [] + : [].concat(leaf); } else { obj = options.plainObjects ? Object.create(null) : {}; var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; - var index = parseInt(cleanRoot, 10); - if (!options.parseArrays && cleanRoot === '') { + var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot; + var index = parseInt(decodedRoot, 10); + if (!options.parseArrays && decodedRoot === '') { obj = { 0: leaf }; } else if ( !isNaN(index) - && root !== cleanRoot - && String(index) === cleanRoot + && root !== decodedRoot + && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit) ) { obj = []; obj[index] = leaf; - } else if (cleanRoot !== '__proto__') { - obj[cleanRoot] = leaf; + } else if (decodedRoot !== '__proto__') { + obj[decodedRoot] = leaf; } } @@ -33708,9 +33727,12 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars keys.push(segment[1]); } - // If there's a remainder, just add whatever is left + // If there's a remainder, check strictDepth option for throw, else just add whatever is left if (segment) { + if (options.strictDepth === true) { + throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true'); + } keys.push('[' + key.slice(segment.index) + ']'); } @@ -33722,7 +33744,15 @@ var normalizeParseOptions = function normalizeParseOptions(opts) { return defaults; } - if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') { + if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') { + throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); + } + + if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') { + throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided'); + } + + if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') { throw new TypeError('Decoder has to be a function.'); } @@ -33731,23 +33761,35 @@ var normalizeParseOptions = function normalizeParseOptions(opts) { } var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; + var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates; + + if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') { + throw new TypeError('The duplicates option must be either combine, first, or last'); + } + + var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots; + return { - allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + allowDots: allowDots, + allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse, arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, charset: charset, charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, + decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys, decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, // eslint-disable-next-line no-implicit-coercion, no-extra-parens depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth, + duplicates: duplicates, ignoreQueryPrefix: opts.ignoreQueryPrefix === true, interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, parseArrays: opts.parseArrays !== false, plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, + strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth, strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling }; }; @@ -33820,10 +33862,13 @@ var defaultFormat = formats['default']; var defaults = { addQueryPrefix: false, allowDots: false, + allowEmptyArrays: false, + arrayFormat: 'indices', charset: 'utf-8', charsetSentinel: false, delimiter: '&', encode: true, + encodeDotInKeys: false, encoder: utils.encode, encodeValuesOnly: false, format: defaultFormat, @@ -33852,8 +33897,10 @@ var stringify = function stringify( prefix, generateArrayPrefix, commaRoundTrip, + allowEmptyArrays, strictNullHandling, skipNulls, + encodeDotInKeys, encoder, filter, sort, @@ -33935,7 +33982,13 @@ var stringify = function stringify( objKeys = sort ? keys.sort(sort) : keys; } - var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix; + var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix; + + var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix; + + if (allowEmptyArrays && isArray(obj) && obj.length === 0) { + return adjustedPrefix + '[]'; + } for (var j = 0; j < objKeys.length; ++j) { var key = objKeys[j]; @@ -33945,9 +33998,10 @@ var stringify = function stringify( continue; } + var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key; var keyPrefix = isArray(obj) - ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix - : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']'); + ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix + : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']'); sideChannel.set(object, step); var valueSideChannel = getSideChannel(); @@ -33957,8 +34011,10 @@ var stringify = function stringify( keyPrefix, generateArrayPrefix, commaRoundTrip, + allowEmptyArrays, strictNullHandling, skipNulls, + encodeDotInKeys, generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, @@ -33980,6 +34036,14 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { return defaults; } + if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') { + throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); + } + + if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') { + throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided'); + } + if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') { throw new TypeError('Encoder has to be a function.'); } @@ -34003,13 +34067,32 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { filter = opts.filter; } + var arrayFormat; + if (opts.arrayFormat in arrayPrefixGenerators) { + arrayFormat = opts.arrayFormat; + } else if ('indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = defaults.arrayFormat; + } + + if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { + throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); + } + + var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots; + return { addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, - allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + allowDots: allowDots, + allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, + arrayFormat: arrayFormat, charset: charset, charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + commaRoundTrip: opts.commaRoundTrip, delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys, encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, filter: filter, @@ -34043,20 +34126,8 @@ module.exports = function (object, opts) { return ''; } - var arrayFormat; - if (opts && opts.arrayFormat in arrayPrefixGenerators) { - arrayFormat = opts.arrayFormat; - } else if (opts && 'indices' in opts) { - arrayFormat = opts.indices ? 'indices' : 'repeat'; - } else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; - if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { - throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); - } - var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip; + var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat]; + var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip; if (!objKeys) { objKeys = Object.keys(obj); @@ -34078,8 +34149,10 @@ module.exports = function (object, opts) { key, generateArrayPrefix, commaRoundTrip, + options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, + options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, @@ -34243,6 +34316,10 @@ var decode = function (str, decoder, charset) { } }; +var limit = 1024; + +/* eslint operator-linebreak: [2, "before"] */ + var encode = function encode(str, defaultEncoder, charset, kind, format) { // This code was originally written by Brian White (mscdex) for the io.js core querystring library. // It has been adapted here for stricter adherence to RFC 3986 @@ -34264,45 +34341,54 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) { } var out = ''; - for (var i = 0; i < string.length; ++i) { - var c = string.charCodeAt(i); - - if ( - c === 0x2D // - - || c === 0x2E // . - || c === 0x5F // _ - || c === 0x7E // ~ - || (c >= 0x30 && c <= 0x39) // 0-9 - || (c >= 0x41 && c <= 0x5A) // a-z - || (c >= 0x61 && c <= 0x7A) // A-Z - || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( ) - ) { - out += string.charAt(i); - continue; - } + for (var j = 0; j < string.length; j += limit) { + var segment = string.length >= limit ? string.slice(j, j + limit) : string; + var arr = []; + + for (var i = 0; i < segment.length; ++i) { + var c = segment.charCodeAt(i); + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( ) + ) { + arr[arr.length] = segment.charAt(i); + continue; + } - if (c < 0x80) { - out = out + hexTable[c]; - continue; - } + if (c < 0x80) { + arr[arr.length] = hexTable[c]; + continue; + } - if (c < 0x800) { - out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } + if (c < 0x800) { + arr[arr.length] = hexTable[0xC0 | (c >> 6)] + + hexTable[0x80 | (c & 0x3F)]; + continue; + } - if (c < 0xD800 || c >= 0xE000) { - out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - continue; + if (c < 0xD800 || c >= 0xE000) { + arr[arr.length] = hexTable[0xE0 | (c >> 12)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF)); + + arr[arr.length] = hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; } - i += 1; - c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); - /* eslint operator-linebreak: [2, "before"] */ - out += hexTable[0xF0 | (c >> 18)] - + hexTable[0x80 | ((c >> 12) & 0x3F)] - + hexTable[0x80 | ((c >> 6) & 0x3F)] - + hexTable[0x80 | (c & 0x3F)]; + out += arr.join(''); } return out; @@ -34459,42 +34545,54 @@ var $mapHas = callBound('Map.prototype.has', true); * * That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly. */ +/** @type {import('.').listGetNode} */ var listGetNode = function (list, key) { // eslint-disable-line consistent-return - for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) { + /** @type {typeof list | NonNullable<(typeof list)['next']>} */ + var prev = list; + /** @type {(typeof list)['next']} */ + var curr; + for (; (curr = prev.next) !== null; prev = curr) { if (curr.key === key) { prev.next = curr.next; - curr.next = list.next; + // eslint-disable-next-line no-extra-parens + curr.next = /** @type {NonNullable} */ (list.next); list.next = curr; // eslint-disable-line no-param-reassign return curr; } } }; +/** @type {import('.').listGet} */ var listGet = function (objects, key) { var node = listGetNode(objects, key); return node && node.value; }; +/** @type {import('.').listSet} */ var listSet = function (objects, key, value) { var node = listGetNode(objects, key); if (node) { node.value = value; } else { // Prepend the new node to the beginning of the list - objects.next = { // eslint-disable-line no-param-reassign + objects.next = /** @type {import('.').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens key: key, next: objects.next, value: value - }; + }); } }; +/** @type {import('.').listHas} */ var listHas = function (objects, key) { return !!listGetNode(objects, key); }; +/** @type {import('.')} */ module.exports = function getSideChannel() { - var $wm; - var $m; - var $o; + /** @type {WeakMap} */ var $wm; + /** @type {Map} */ var $m; + /** @type {import('.').RootNode} */ var $o; + + /** @type {import('.').Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { @@ -39393,7 +39491,6 @@ function render(_ctx, _cache) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CommandManager: () => (/* binding */ CommandManager), -/* harmony export */ DropPlugin: () => (/* binding */ DropPlugin), /* harmony export */ Editor: () => (/* binding */ Editor), /* harmony export */ Extension: () => (/* binding */ Extension), /* harmony export */ InputRule: () => (/* binding */ InputRule), @@ -39401,7 +39498,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ Node: () => (/* binding */ Node), /* harmony export */ NodePos: () => (/* binding */ NodePos), /* harmony export */ NodeView: () => (/* binding */ NodeView), -/* harmony export */ PastePlugin: () => (/* binding */ PastePlugin), /* harmony export */ PasteRule: () => (/* binding */ PasteRule), /* harmony export */ Tracker: () => (/* binding */ Tracker), /* harmony export */ callOrReturn: () => (/* binding */ callOrReturn), @@ -39837,6 +39933,7 @@ function mergeAttributes(...objects) { function getRenderedAttributes(nodeOrMark, extensionAttributes) { return extensionAttributes + .filter(attribute => attribute.type === nodeOrMark.type.name) .filter(item => item.attribute.rendered) .map(item => { if (!item.attribute.renderHTML) { @@ -40273,6 +40370,123 @@ function inputRulesPlugin(props) { return plugin; } +// see: https://github.com/mesqueeb/is-what/blob/88d6e4ca92fb2baab6003c54e02eedf4e729e5ab/src/index.ts +function getType(value) { + return Object.prototype.toString.call(value).slice(8, -1); +} +function isPlainObject(value) { + if (getType(value) !== 'Object') { + return false; + } + return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype; +} + +function mergeDeep(target, source) { + const output = { ...target }; + if (isPlainObject(target) && isPlainObject(source)) { + Object.keys(source).forEach(key => { + if (isPlainObject(source[key]) && isPlainObject(target[key])) { + output[key] = mergeDeep(target[key], source[key]); + } + else { + output[key] = source[key]; + } + }); + } + return output; +} + +/** + * The Mark class is used to create custom mark extensions. + * @see https://tiptap.dev/api/extensions#create-a-new-extension + */ +class Mark { + constructor(config = {}) { + this.type = 'mark'; + this.name = 'mark'; + this.parent = null; + this.child = null; + this.config = { + name: this.name, + defaultOptions: {}, + }; + this.config = { + ...this.config, + ...config, + }; + this.name = this.config.name; + if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) { + console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`); + } + // TODO: remove `addOptions` fallback + this.options = this.config.defaultOptions; + if (this.config.addOptions) { + this.options = callOrReturn(getExtensionField(this, 'addOptions', { + name: this.name, + })); + } + this.storage = callOrReturn(getExtensionField(this, 'addStorage', { + name: this.name, + options: this.options, + })) || {}; + } + static create(config = {}) { + return new Mark(config); + } + configure(options = {}) { + // return a new instance so we can use the same extension + // with different calls of `configure` + const extension = this.extend({ + ...this.config, + addOptions: () => { + return mergeDeep(this.options, options); + }, + }); + // Always preserve the current name + extension.name = this.name; + // Set the parent to be our parent + extension.parent = this.parent; + return extension; + } + extend(extendedConfig = {}) { + const extension = new Mark(extendedConfig); + extension.parent = this; + this.child = extension; + extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name; + if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) { + console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`); + } + extension.options = callOrReturn(getExtensionField(extension, 'addOptions', { + name: extension.name, + })); + extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', { + name: extension.name, + options: extension.options, + })); + return extension; + } + static handleExit({ editor, mark }) { + const { tr } = editor.state; + const currentPos = editor.state.selection.$from; + const isAtEnd = currentPos.pos === currentPos.end(); + if (isAtEnd) { + const currentMarks = currentPos.marks(); + const isInMark = !!currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name); + if (!isInMark) { + return false; + } + const removeMark = currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name); + if (removeMark) { + tr.removeStoredMark(removeMark); + } + tr.insertText(' ', currentPos.pos); + editor.view.dispatch(tr); + return true; + } + return false; + } +} + function isNumber(value) { return typeof value === 'number'; } @@ -40732,32 +40946,6 @@ class ExtensionManager { } } -// see: https://github.com/mesqueeb/is-what/blob/88d6e4ca92fb2baab6003c54e02eedf4e729e5ab/src/index.ts -function getType(value) { - return Object.prototype.toString.call(value).slice(8, -1); -} -function isPlainObject(value) { - if (getType(value) !== 'Object') { - return false; - } - return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype; -} - -function mergeDeep(target, source) { - const output = { ...target }; - if (isPlainObject(target) && isPlainObject(source)) { - Object.keys(source).forEach(key => { - if (isPlainObject(source[key]) && isPlainObject(target[key])) { - output[key] = mergeDeep(target[key], source[key]); - } - else { - output[key] = source[key]; - } - }); - } - return output; -} - /** * The Extension class is the base class for all extensions. * @see https://tiptap.dev/api/extensions#create-a-new-extension @@ -43041,6 +43229,27 @@ const Commands = Extension.create({ }, }); +const Drop = Extension.create({ + name: 'drop', + addProseMirrorPlugins() { + return [ + new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.Plugin({ + key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.PluginKey('tiptapDrop'), + props: { + handleDrop: (_, e, slice, moved) => { + this.editor.emit('drop', { + editor: this.editor, + event: e, + slice, + moved, + }); + }, + }, + }), + ]; + }, +}); + const Editable = Extension.create({ name: 'editable', addProseMirrorPlugins() { @@ -43205,6 +43414,26 @@ const Keymap = Extension.create({ }, }); +const Paste = Extension.create({ + name: 'paste', + addProseMirrorPlugins() { + return [ + new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.Plugin({ + key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.PluginKey('tiptapPaste'), + props: { + handlePaste: (_view, e, slice) => { + this.editor.emit('paste', { + editor: this.editor, + event: e, + slice, + }); + }, + }, + }), + ]; + }, +}); + const Tabindex = Extension.create({ name: 'tabindex', addProseMirrorPlugins() { @@ -43223,9 +43452,11 @@ var index = /*#__PURE__*/Object.freeze({ __proto__: null, ClipboardTextSerializer: ClipboardTextSerializer, Commands: Commands, + Drop: Drop, Editable: Editable, FocusEvents: FocusEvents, Keymap: Keymap, + Paste: Paste, Tabindex: Tabindex }); @@ -43405,28 +43636,6 @@ class NodePos { } } -const DropPlugin = (onDrop) => { - return new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.Plugin({ - key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.PluginKey('tiptapDrop'), - props: { - handleDrop: (_, e, slice, moved) => { - onDrop(e, slice, moved); - }, - }, - }); -}; - -const PastePlugin = (onPaste) => { - return new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.Plugin({ - key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_0__.PluginKey('tiptapPaste'), - props: { - handlePaste: (_view, e, slice) => { - onPaste(e, slice); - }, - }, - }); -}; - const style = `.ProseMirror { position: relative; } @@ -43572,12 +43781,8 @@ class Editor extends EventEmitter { this.on('focus', this.options.onFocus); this.on('blur', this.options.onBlur); this.on('destroy', this.options.onDestroy); - if (this.options.onPaste) { - this.registerPlugin(PastePlugin(this.options.onPaste)); - } - if (this.options.onDrop) { - this.registerPlugin(DropPlugin(this.options.onDrop)); - } + this.on('drop', ({ event, slice, moved }) => this.options.onDrop(event, slice, moved)); + this.on('paste', ({ event, slice }) => this.options.onPaste(event, slice)); window.setTimeout(() => { if (this.isDestroyed) { return; @@ -43666,6 +43871,7 @@ class Editor extends EventEmitter { * * @param plugin A ProseMirror plugin * @param handlePlugins Control how to merge the plugin into the existing plugins. + * @returns The new editor state */ registerPlugin(plugin, handlePlugins) { const plugins = isFunction(handlePlugins) @@ -43673,15 +43879,17 @@ class Editor extends EventEmitter { : [...this.state.plugins, plugin]; const state = this.state.reconfigure({ plugins }); this.view.updateState(state); + return state; } /** * Unregister a ProseMirror plugin. * * @param nameOrPluginKey The plugins name + * @returns The new editor state or undefined if the editor is destroyed */ unregisterPlugin(nameOrPluginKey) { if (this.isDestroyed) { - return; + return undefined; } // @ts-ignore const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key; @@ -43690,6 +43898,7 @@ class Editor extends EventEmitter { plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(name)), }); this.view.updateState(state); + return state; } /** * Creates an extension manager. @@ -43705,6 +43914,8 @@ class Editor extends EventEmitter { FocusEvents, Keymap, Tabindex, + Drop, + Paste, ].filter(ext => { if (typeof this.options.enableCoreExtensions === 'object') { return this.options.enableCoreExtensions[ext.name] !== false; @@ -43922,6 +44133,12 @@ class Editor extends EventEmitter { destroy() { this.emit('destroy'); if (this.view) { + // Cleanup our reference to prevent circular references which caused memory leaks + // @ts-ignore + const dom = this.view.dom; + if (dom && dom.editor) { + delete dom.editor; + } this.view.destroy(); } this.removeAllListeners(); @@ -44137,104 +44354,13 @@ function wrappingInputRule(config) { } /** - * The Mark class is used to create custom mark extensions. + * The Node class is used to create custom node extensions. * @see https://tiptap.dev/api/extensions#create-a-new-extension */ -class Mark { +class Node { constructor(config = {}) { - this.type = 'mark'; - this.name = 'mark'; - this.parent = null; - this.child = null; - this.config = { - name: this.name, - defaultOptions: {}, - }; - this.config = { - ...this.config, - ...config, - }; - this.name = this.config.name; - if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) { - console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`); - } - // TODO: remove `addOptions` fallback - this.options = this.config.defaultOptions; - if (this.config.addOptions) { - this.options = callOrReturn(getExtensionField(this, 'addOptions', { - name: this.name, - })); - } - this.storage = callOrReturn(getExtensionField(this, 'addStorage', { - name: this.name, - options: this.options, - })) || {}; - } - static create(config = {}) { - return new Mark(config); - } - configure(options = {}) { - // return a new instance so we can use the same extension - // with different calls of `configure` - const extension = this.extend({ - ...this.config, - addOptions: () => { - return mergeDeep(this.options, options); - }, - }); - // Always preserve the current name - extension.name = this.name; - // Set the parent to be our parent - extension.parent = this.parent; - return extension; - } - extend(extendedConfig = {}) { - const extension = new Mark(extendedConfig); - extension.parent = this; - this.child = extension; - extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name; - if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) { - console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`); - } - extension.options = callOrReturn(getExtensionField(extension, 'addOptions', { - name: extension.name, - })); - extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', { - name: extension.name, - options: extension.options, - })); - return extension; - } - static handleExit({ editor, mark }) { - const { tr } = editor.state; - const currentPos = editor.state.selection.$from; - const isAtEnd = currentPos.pos === currentPos.end(); - if (isAtEnd) { - const currentMarks = currentPos.marks(); - const isInMark = !!currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name); - if (!isInMark) { - return false; - } - const removeMark = currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name); - if (removeMark) { - tr.removeStoredMark(removeMark); - } - tr.insertText(' ', currentPos.pos); - editor.view.dispatch(tr); - return true; - } - return false; - } -} - -/** - * The Node class is used to create custom node extensions. - * @see https://tiptap.dev/api/extensions#create-a-new-extension - */ -class Node { - constructor(config = {}) { - this.type = 'node'; - this.name = 'node'; + this.type = 'node'; + this.name = 'node'; this.parent = null; this.child = null; this.config = { @@ -45090,86 +45216,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (/* binding */ BulletList), /* harmony export */ inputRegex: () => (/* binding */ inputRegex) /* harmony export */ }); -/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js"); +/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js"); +/* harmony import */ var _tiptap_extension_list_item__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/extension-list-item */ "./node_modules/@tiptap/extension-list-item/dist/index.js"); +/* harmony import */ var _tiptap_extension_text_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tiptap/extension-text-style */ "./node_modules/@tiptap/extension-text-style/dist/index.js"); -/** - * This extension allows you to create list items. - * @see https://www.tiptap.dev/api/nodes/list-item - */ -const ListItem = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ - name: 'listItem', - addOptions() { - return { - HTMLAttributes: {}, - bulletListTypeName: 'bulletList', - orderedListTypeName: 'orderedList', - }; - }, - content: 'paragraph block*', - defining: true, - parseHTML() { - return [ - { - tag: 'li', - }, - ]; - }, - renderHTML({ HTMLAttributes }) { - return ['li', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; - }, - addKeyboardShortcuts() { - return { - Enter: () => this.editor.commands.splitListItem(this.name), - Tab: () => this.editor.commands.sinkListItem(this.name), - 'Shift-Tab': () => this.editor.commands.liftListItem(this.name), - }; - }, -}); -/** - * This extension allows you to create text styles. It is required by default - * for the `textColor` and `backgroundColor` extensions. - * @see https://www.tiptap.dev/api/marks/text-style - */ -const TextStyle = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({ - name: 'textStyle', - priority: 101, - addOptions() { - return { - HTMLAttributes: {}, - }; - }, - parseHTML() { - return [ - { - tag: 'span', - getAttrs: element => { - const hasStyles = element.hasAttribute('style'); - if (!hasStyles) { - return false; - } - return {}; - }, - }, - ]; - }, - renderHTML({ HTMLAttributes }) { - return ['span', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; - }, - addCommands() { - return { - removeEmptyTextStyle: () => ({ state, commands }) => { - const attributes = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.getMarkAttributes)(state, this.type); - const hasStyles = Object.entries(attributes).some(([, value]) => !!value); - if (hasStyles) { - return true; - } - return commands.unsetMark(this.name); - }, - }; - }, -}); /** * Matches a bullet list to a dash or asterisk. @@ -45181,7 +45233,7 @@ const inputRegex = /^\s*([-+*])\s$/; * @see https://tiptap.dev/api/nodes/bullet-list * @see https://tiptap.dev/api/nodes/list-item. */ -const BulletList = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ +const BulletList = _tiptap_core__WEBPACK_IMPORTED_MODULE_2__.Node.create({ name: 'bulletList', addOptions() { return { @@ -45201,13 +45253,13 @@ const BulletList = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ ]; }, renderHTML({ HTMLAttributes }) { - return ['ul', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; + return ['ul', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; }, addCommands() { return { toggleBulletList: () => ({ commands, chain }) => { if (this.options.keepAttributes) { - return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run(); + return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(_tiptap_extension_list_item__WEBPACK_IMPORTED_MODULE_0__.ListItem.name, this.editor.getAttributes(_tiptap_extension_text_style__WEBPACK_IMPORTED_MODULE_1__.TextStyle.name)).run(); } return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks); }, @@ -45219,17 +45271,17 @@ const BulletList = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ }; }, addInputRules() { - let inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.wrappingInputRule)({ + let inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.wrappingInputRule)({ find: inputRegex, type: this.type, }); if (this.options.keepMarks || this.options.keepAttributes) { - inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.wrappingInputRule)({ + inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.wrappingInputRule)({ find: inputRegex, type: this.type, keepMarks: this.options.keepMarks, keepAttributes: this.options.keepAttributes, - getAttributes: () => { return this.editor.getAttributes(TextStyle.name); }, + getAttributes: () => { return this.editor.getAttributes(_tiptap_extension_text_style__WEBPACK_IMPORTED_MODULE_1__.TextStyle.name); }, editor: this.editor, }); } @@ -45272,6 +45324,8 @@ const CharacterCount = _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.Extension.creat return { limit: null, mode: 'textSize', + textCounter: text => text.length, + wordCounter: text => text.split(' ').filter(word => word !== '').length, }; }, addStorage() { @@ -45286,15 +45340,14 @@ const CharacterCount = _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.Extension.creat const mode = (options === null || options === void 0 ? void 0 : options.mode) || this.options.mode; if (mode === 'textSize') { const text = node.textBetween(0, node.content.size, undefined, ' '); - return text.length; + return this.options.textCounter(text); } return node.nodeSize; }; this.storage.words = options => { const node = (options === null || options === void 0 ? void 0 : options.node) || this.editor.state.doc; const text = node.textBetween(0, node.content.size, ' ', ' '); - const words = text.split(' ').filter(word => word !== ''); - return words.length; + return this.options.wordCounter(text); }; }, addProseMirrorPlugins() { @@ -49760,86 +49813,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (/* binding */ OrderedList), /* harmony export */ inputRegex: () => (/* binding */ inputRegex) /* harmony export */ }); -/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js"); +/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js"); +/* harmony import */ var _tiptap_extension_list_item__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/extension-list-item */ "./node_modules/@tiptap/extension-list-item/dist/index.js"); +/* harmony import */ var _tiptap_extension_text_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tiptap/extension-text-style */ "./node_modules/@tiptap/extension-text-style/dist/index.js"); -/** - * This extension allows you to create list items. - * @see https://www.tiptap.dev/api/nodes/list-item - */ -const ListItem = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ - name: 'listItem', - addOptions() { - return { - HTMLAttributes: {}, - bulletListTypeName: 'bulletList', - orderedListTypeName: 'orderedList', - }; - }, - content: 'paragraph block*', - defining: true, - parseHTML() { - return [ - { - tag: 'li', - }, - ]; - }, - renderHTML({ HTMLAttributes }) { - return ['li', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; - }, - addKeyboardShortcuts() { - return { - Enter: () => this.editor.commands.splitListItem(this.name), - Tab: () => this.editor.commands.sinkListItem(this.name), - 'Shift-Tab': () => this.editor.commands.liftListItem(this.name), - }; - }, -}); -/** - * This extension allows you to create text styles. It is required by default - * for the `textColor` and `backgroundColor` extensions. - * @see https://www.tiptap.dev/api/marks/text-style - */ -const TextStyle = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({ - name: 'textStyle', - priority: 101, - addOptions() { - return { - HTMLAttributes: {}, - }; - }, - parseHTML() { - return [ - { - tag: 'span', - getAttrs: element => { - const hasStyles = element.hasAttribute('style'); - if (!hasStyles) { - return false; - } - return {}; - }, - }, - ]; - }, - renderHTML({ HTMLAttributes }) { - return ['span', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; - }, - addCommands() { - return { - removeEmptyTextStyle: () => ({ state, commands }) => { - const attributes = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.getMarkAttributes)(state, this.type); - const hasStyles = Object.entries(attributes).some(([, value]) => !!value); - if (hasStyles) { - return true; - } - return commands.unsetMark(this.name); - }, - }; - }, -}); /** * Matches an ordered list to a 1. on input (or any number followed by a dot). @@ -49851,7 +49830,7 @@ const inputRegex = /^(\d+)\.\s$/; * @see https://www.tiptap.dev/api/nodes/ordered-list * @see https://www.tiptap.dev/api/nodes/list-item */ -const OrderedList = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ +const OrderedList = _tiptap_core__WEBPACK_IMPORTED_MODULE_2__.Node.create({ name: 'orderedList', addOptions() { return { @@ -49891,14 +49870,14 @@ const OrderedList = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ renderHTML({ HTMLAttributes }) { const { start, ...attributesWithoutStart } = HTMLAttributes; return start === 1 - ? ['ol', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, attributesWithoutStart), 0] - : ['ol', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; + ? ['ol', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.mergeAttributes)(this.options.HTMLAttributes, attributesWithoutStart), 0] + : ['ol', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; }, addCommands() { return { toggleOrderedList: () => ({ commands, chain }) => { if (this.options.keepAttributes) { - return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run(); + return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(_tiptap_extension_list_item__WEBPACK_IMPORTED_MODULE_0__.ListItem.name, this.editor.getAttributes(_tiptap_extension_text_style__WEBPACK_IMPORTED_MODULE_1__.TextStyle.name)).run(); } return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks); }, @@ -49910,19 +49889,19 @@ const OrderedList = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({ }; }, addInputRules() { - let inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.wrappingInputRule)({ + let inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.wrappingInputRule)({ find: inputRegex, type: this.type, getAttributes: match => ({ start: +match[1] }), joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1], }); if (this.options.keepMarks || this.options.keepAttributes) { - inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.wrappingInputRule)({ + inputRule = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_2__.wrappingInputRule)({ find: inputRegex, type: this.type, keepMarks: this.options.keepMarks, keepAttributes: this.options.keepAttributes, - getAttributes: match => ({ start: +match[1], ...this.editor.getAttributes(TextStyle.name) }), + getAttributes: match => ({ start: +match[1], ...this.editor.getAttributes(_tiptap_extension_text_style__WEBPACK_IMPORTED_MODULE_1__.TextStyle.name) }), joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1], editor: this.editor, }); @@ -50803,6 +50782,71 @@ const TextAlign = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Extension.create({ //# sourceMappingURL=index.js.map +/***/ }), + +/***/ "./node_modules/@tiptap/extension-text-style/dist/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@tiptap/extension-text-style/dist/index.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ TextStyle: () => (/* binding */ TextStyle), +/* harmony export */ "default": () => (/* binding */ TextStyle) +/* harmony export */ }); +/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js"); + + +/** + * This extension allows you to create text styles. It is required by default + * for the `textColor` and `backgroundColor` extensions. + * @see https://www.tiptap.dev/api/marks/text-style + */ +const TextStyle = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({ + name: 'textStyle', + priority: 101, + addOptions() { + return { + HTMLAttributes: {}, + }; + }, + parseHTML() { + return [ + { + tag: 'span', + getAttrs: element => { + const hasStyles = element.hasAttribute('style'); + if (!hasStyles) { + return false; + } + return {}; + }, + }, + ]; + }, + renderHTML({ HTMLAttributes }) { + return ['span', (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0]; + }, + addCommands() { + return { + removeEmptyTextStyle: () => ({ state, commands }) => { + const attributes = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.getMarkAttributes)(state, this.type); + const hasStyles = Object.entries(attributes).some(([, value]) => !!value); + if (hasStyles) { + return true; + } + return commands.unsetMark(this.name); + }, + }; + }, +}); + + +//# sourceMappingURL=index.js.map + + /***/ }), /***/ "./node_modules/@tiptap/extension-text/dist/index.js": @@ -51382,7 +51426,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ BubbleMenu: () => (/* binding */ BubbleMenu), /* harmony export */ CommandManager: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.CommandManager), -/* harmony export */ DropPlugin: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.DropPlugin), /* harmony export */ Editor: () => (/* binding */ Editor), /* harmony export */ EditorContent: () => (/* binding */ EditorContent), /* harmony export */ Extension: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.Extension), @@ -51394,7 +51437,6 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ NodeView: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.NodeView), /* harmony export */ NodeViewContent: () => (/* binding */ NodeViewContent), /* harmony export */ NodeViewWrapper: () => (/* binding */ NodeViewWrapper), -/* harmony export */ PastePlugin: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.PastePlugin), /* harmony export */ PasteRule: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.PasteRule), /* harmony export */ Tracker: () => (/* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.Tracker), /* harmony export */ VueNodeViewRenderer: () => (/* binding */ VueNodeViewRenderer), @@ -51582,19 +51624,21 @@ class Editor extends _tiptap_core__WEBPACK_IMPORTED_MODULE_1__.Editor { * Register a ProseMirror plugin. */ registerPlugin(plugin, handlePlugins) { - super.registerPlugin(plugin, handlePlugins); + const nextState = super.registerPlugin(plugin, handlePlugins); if (this.reactiveState) { - this.reactiveState.value = this.view.state; + this.reactiveState.value = nextState; } + return nextState; } /** * Unregister a ProseMirror plugin. */ unregisterPlugin(nameOrPluginKey) { - super.unregisterPlugin(nameOrPluginKey); - if (this.reactiveState) { - this.reactiveState.value = this.view.state; + const nextState = super.unregisterPlugin(nameOrPluginKey); + if (this.reactiveState && nextState) { + this.reactiveState.value = nextState; } + return nextState; } } @@ -120420,30 +120464,29 @@ function splitBlockAs(splitNode) { } if (!$from.parent.isBlock) return false; - if (dispatch) { - let atEnd = $to.parentOffset == $to.parent.content.size; - let tr = state.tr; - if (state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.TextSelection || state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.AllSelection) - tr.deleteSelection(); - let deflt = $from.depth == 0 ? null : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1))); - let splitType = splitNode && splitNode($to.parent, atEnd, $from); - let types = splitType ? [splitType] : atEnd && deflt ? [{ type: deflt }] : undefined; - let can = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, types); - if (!types && !can && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : undefined)) { - if (deflt) - types = [{ type: deflt }]; - can = true; - } - if (can) { - tr.split(tr.mapping.map($from.pos), 1, types); - if (!atEnd && !$from.parentOffset && $from.parent.type != deflt) { - let first = tr.mapping.map($from.before()), $first = tr.doc.resolve(first); - if (deflt && $from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) - tr.setNodeMarkup(tr.mapping.map($from.before()), deflt); - } - } - dispatch(tr.scrollIntoView()); + let atEnd = $to.parentOffset == $to.parent.content.size; + let tr = state.tr; + if (state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.TextSelection || state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.AllSelection) + tr.deleteSelection(); + let deflt = $from.depth == 0 ? null : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1))); + let splitType = splitNode && splitNode($to.parent, atEnd, $from); + let types = splitType ? [splitType] : atEnd && deflt ? [{ type: deflt }] : undefined; + let can = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, types); + if (!types && !can && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : undefined)) { + if (deflt) + types = [{ type: deflt }]; + can = true; + } + if (!can) + return false; + tr.split(tr.mapping.map($from.pos), 1, types); + if (!atEnd && !$from.parentOffset && $from.parent.type != deflt) { + let first = tr.mapping.map($from.before()), $first = tr.doc.resolve(first); + if (deflt && $from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) + tr.setNodeMarkup(tr.mapping.map($from.before()), deflt); } + if (dispatch) + dispatch(tr.scrollIntoView()); return true; }; } @@ -120498,10 +120541,7 @@ function joinMaybeClear(state, $pos, dispatch) { if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(state.doc, $pos.pos))) return false; if (dispatch) - dispatch(state.tr - .clearIncompatible($pos.pos, before.type, before.contentMatchAt(before.childCount)) - .join($pos.pos) - .scrollIntoView()); + dispatch(state.tr.join($pos.pos).scrollIntoView()); return true; } function deleteBarrier(state, $cut, dispatch, dir) { @@ -120519,9 +120559,10 @@ function deleteBarrier(state, $cut, dispatch, dir) { wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_2__.Fragment.from(conn[i].create(null, wrap)); wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_2__.Fragment.from(before.copy(wrap)); let tr = state.tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new prosemirror_model__WEBPACK_IMPORTED_MODULE_2__.Slice(wrap, 1, 0), conn.length, true)); - let joinAt = end + 2 * conn.length; - if ((0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, joinAt)) - tr.join(joinAt); + let $joinAt = tr.doc.resolve(end + 2 * conn.length); + if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && + (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, $joinAt.pos)) + tr.join($joinAt.pos); dispatch(tr.scrollIntoView()); } return true; @@ -123748,7 +123789,7 @@ function resolveName(stream, name) { let result = []; for (let typeName in types) { let type = types[typeName]; - if (type.groups.indexOf(name) > -1) + if (type.isInGroup(name)) result.push(type); } if (result.length == 0) @@ -124027,6 +124068,13 @@ class NodeType { */ get isAtom() { return this.isLeaf || !!this.spec.atom; } /** + Return true when this node type is part of the given + [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group). + */ + isInGroup(group) { + return this.groups.indexOf(group) > -1; + } + /** The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option. */ get whitespace() { @@ -124859,6 +124907,7 @@ class ParseContext { contentDOM = rule.contentElement; this.findAround(dom, contentDOM, true); this.addAll(contentDOM, marks); + this.findAround(dom, contentDOM, false); } if (sync && this.sync(startIn)) this.open--; @@ -125037,7 +125086,7 @@ class ParseContext { let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null; - if (!next || (next.name != part && next.groups.indexOf(part) == -1)) + if (!next || (next.name != part && !next.isInGroup(part))) return false; depth--; } @@ -130336,8 +130385,24 @@ function canJoin(doc, pos) { return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1); } +function canAppendWithSubstitutedLinebreaks(a, b) { + if (!b.content.size) + a.type.compatibleContent(b.type); + let match = a.contentMatchAt(a.childCount); + let { linebreakReplacement } = a.type.schema; + for (let i = 0; i < b.childCount; i++) { + let child = b.child(i); + let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type; + match = match.matchType(type); + if (!match) + return false; + if (!a.type.allowsMarks(child.marks)) + return false; + } + return match.validEnd; +} function joinable(a, b) { - return !!(a && b && !a.isLeaf && a.canAppend(b)); + return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b)); } /** Find an ancestor of the given position that can be joined to the @@ -130370,8 +130435,31 @@ function joinPoint(doc, pos, dir = -1) { } } function join(tr, pos, depth) { - let step = new ReplaceStep(pos - depth, pos + depth, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty, true); - tr.step(step); + let convertNewlines = null; + let { linebreakReplacement } = tr.doc.type.schema; + let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type; + if (linebreakReplacement && beforeType.inlineContent) { + let pre = beforeType.whitespace == "pre"; + let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement); + if (pre && !supportLinebreak) + convertNewlines = false; + else if (!pre && supportLinebreak) + convertNewlines = true; + } + let mapFrom = tr.steps.length; + if (convertNewlines === false) { + let $after = tr.doc.resolve(pos + depth); + replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom); + } + if (beforeType.inlineContent) + clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null); + let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth); + tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty, true)); + if (convertNewlines === true) { + let $full = tr.doc.resolve(start); + replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length); + } + return tr; } /** Try to find a point where a node of the given type can be inserted @@ -130855,7 +130943,8 @@ function deleteRange(tr, from, to) { return tr.delete($from.before(depth), $to.after(depth)); } for (let d = 1; d <= $from.depth && d <= $to.depth; d++) { - if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d) + if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && + $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) return tr.delete($from.before(d), to); } tr.delete(from, to); @@ -133155,6 +133244,7 @@ class ViewTreeUpdater { return true; } else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) { + this.destroyBetween(this.index, i); this.top.children[this.index] = updated; if (updated.contentDOM) { updated.dirty = CONTENT_DIRTY; @@ -133174,7 +133264,8 @@ class ViewTreeUpdater { // identical content, move over its children. recreateWrapper(next, node, outerDeco, innerDeco, view, pos) { if (next.dirty || node.isAtom || !next.children.length || - !next.node.content.eq(node.content)) + !next.node.content.eq(node.content) || + !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco)) return null; let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos); if (wrapper.contentDOM) { @@ -133445,9 +133536,9 @@ function selectionFromDOM(view, origin = null) { let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1); if (head < 0) return null; - let $head = doc.resolve(head), $anchor, selection; + let $head = doc.resolve(head), anchor, selection; if (selectionCollapsed(domSel)) { - $anchor = $head; + anchor = head; while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent; let nearestDescNode = nearestDesc.node; @@ -133458,11 +133549,25 @@ function selectionFromDOM(view, origin = null) { } } else { - let anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1); + if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) { + let min = head, max = head; + for (let i = 0; i < domSel.rangeCount; i++) { + let range = domSel.getRangeAt(i); + min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1)); + max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1)); + } + if (min < 0) + return null; + [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max]; + $head = doc.resolve(head); + } + else { + anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1); + } if (anchor < 0) return null; - $anchor = doc.resolve(anchor); } + let $anchor = doc.resolve(anchor); if (!selection) { let bias = origin == "pointer" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1; selection = selectionBetween(view, $anchor, $head, bias); @@ -137269,6 +137374,209 @@ var Append = /*@__PURE__*/(function (RopeSequence) { /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RopeSequence); +/***/ }), + +/***/ "./node_modules/vue3-sticky-directive/dist/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/vue3-sticky-directive/dist/index.js ***! + \**********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ StickyPlugin: () => (/* binding */ StickyPlugin), +/* harmony export */ "default": () => (/* binding */ StickyPlugin) +/* harmony export */ }); +var a = Object.defineProperty; +var c = (t, e, s) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s; +var o = (t, e, s) => (c(t, typeof e != "symbol" ? e + "" : e, s), s); +const namespace = "@@vue3-sticky-directive", events = [ + "resize", + "scroll", + "touchstart", + "touchmove", + "touchend", + "pageshow", + "load" +], batchStyle = (t, e = {}, s = {}) => { + for (let i in e) + t.style[i] = e[i]; + for (let i in s) + s[i] && !t.classList.contains(i) ? t.classList.add(i) : !s[i] && t.classList.contains(i) && t.classList.remove(i); +}; +class Sticky { + constructor(t, e) { + o(this, "el"); + o(this, "vm"); + o(this, "unSubscribers"); + o(this, "isPending"); + o(this, "state"); + o(this, "lastState"); + o(this, "options"); + o(this, "placeholderEl"); + o(this, "containerEl"); + this.el = t, this.vm = e, this.unSubscribers = [], this.isPending = !1, this.state = { + isTopSticky: null, + isBottomSticky: null, + height: null, + width: null, + xOffset: null + }, this.lastState = { + top: null, + bottom: null, + sticked: !1 + }; + const s = this.getAttribute("sticky-offset") || {}, i = this.getAttribute("sticky-side") || "top", n = this.getAttribute("sticky-z-index") || "10", h = this.getAttribute("on-stick") || null; + this.options = { + topOffset: Number(s.top) || 0, + bottomOffset: Number(s.bottom) || 0, + shouldTopSticky: i === "top" || i === "both", + shouldBottomSticky: i === "bottom" || i === "both", + zIndex: n, + onStick: h + }; + } + doBind() { + if (this.unSubscribers.length > 0) + return; + const { el: t, vm: e } = this; + e.$nextTick(() => { + this.placeholderEl = document.createElement("div"), this.containerEl = this.getContainerEl(), t.parentElement.insertBefore(this.placeholderEl, t), events.forEach((s) => { + const i = this.update.bind(this); + this.unSubscribers.push(() => window.removeEventListener(s, i)), this.unSubscribers.push(() => this.containerEl.removeEventListener(s, i)), window.addEventListener(s, i, { passive: !0 }), this.containerEl.addEventListener(s, i, { passive: !0 }); + }); + }); + } + doUnbind() { + this.unSubscribers.forEach((t) => t()), this.unSubscribers = [], this.resetElement(); + } + update() { + this.isPending || (requestAnimationFrame(() => { + this.isPending = !1, this.recomputeState(), this.updateElements(); + }), this.isPending = !0); + } + isTopSticky() { + if (!this.options.shouldTopSticky) + return !1; + const t = this.state.placeholderElRect.top, e = this.state.containerElRect.bottom, s = this.options.topOffset, i = this.options.bottomOffset; + return t <= s && e >= i; + } + isBottomSticky() { + if (!this.options.shouldBottomSticky) + return !1; + const t = window.innerHeight - this.state.placeholderElRect.top - this.state.height, e = window.innerHeight - this.state.containerElRect.top, s = this.options.topOffset, i = this.options.bottomOffset; + return t <= i && e >= s; + } + recomputeState() { + this.state = Object.assign({}, this.state, { + height: this.getHeight(), + width: this.getWidth(), + xOffset: this.getXOffset(), + placeholderElRect: this.getPlaceholderElRect(), + containerElRect: this.getContainerElRect() + }), this.state.isTopSticky = this.isTopSticky(), this.state.isBottomSticky = this.isBottomSticky(); + } + fireEvents() { + typeof this.options.onStick == "function" && (this.lastState.top !== this.state.isTopSticky || this.lastState.bottom !== this.state.isBottomSticky || this.lastState.sticked !== (this.state.isTopSticky || this.state.isBottomSticky)) && (this.lastState = { + top: this.state.isTopSticky, + bottom: this.state.isBottomSticky, + sticked: this.state.isBottomSticky || this.state.isTopSticky + }, this.options.onStick(this.lastState)); + } + updateElements() { + const t = { + paddingTop: 0 + }, e = { + position: "static", + top: "auto", + bottom: "auto", + left: "auto", + width: "auto", + zIndex: this.options.zIndex + }, s = { + "vue-sticky-placeholder": !0 + }, i = { + "vue-sticky-el": !0, + "top-sticky": !1, + "bottom-sticky": !1 + }; + if (this.state.isTopSticky) { + e.position = "fixed", e.top = this.options.topOffset + "px", e.left = this.state.xOffset + "px", e.width = this.state.width + "px"; + const n = this.state.containerElRect.bottom - this.state.height - this.options.bottomOffset - this.options.topOffset; + n < 0 && (e.top = n + this.options.topOffset + "px"), t.paddingTop = this.state.height + "px", i["top-sticky"] = !0; + } else if (this.state.isBottomSticky) { + e.position = "fixed", e.bottom = this.options.bottomOffset + "px", e.left = this.state.xOffset + "px", e.width = this.state.width + "px"; + const n = window.innerHeight - this.state.containerElRect.top - this.state.height - this.options.bottomOffset - this.options.topOffset; + n < 0 && (e.bottom = n + this.options.bottomOffset + "px"), t.paddingTop = this.state.height + "px", i["bottom-sticky"] = !0; + } else + t.paddingTop = 0; + batchStyle(this.el, e, i), batchStyle(this.placeholderEl, t, s), this.fireEvents(); + } + resetElement() { + ["position", "top", "bottom", "left", "width", "zIndex"].forEach((e) => { + this.el.style.removeProperty(e); + }), this.el.classList.remove("bottom-sticky", "top-sticky"); + const { parentElement: t } = this.placeholderEl; + t && t.removeChild(this.placeholderEl); + } + getContainerEl() { + let t = this.el.parentElement; + for (; t && t.tagName !== "HTML" && t.tagName !== "BODY" && t.nodeType === 1; ) { + if (t.hasAttribute("sticky-container")) + return t; + t = t.parentElement; + } + return this.el.parentElement; + } + getXOffset() { + return this.placeholderEl.getBoundingClientRect().left; + } + getWidth() { + return this.placeholderEl.getBoundingClientRect().width; + } + getHeight() { + return this.el.getBoundingClientRect().height; + } + getPlaceholderElRect() { + return this.placeholderEl.getBoundingClientRect(); + } + getContainerElRect() { + return this.containerEl.getBoundingClientRect(); + } + getAttribute(name) { + const expr = this.el.getAttribute(name); + let result; + if (expr) + if (this.vm[expr]) + result = this.vm[expr]; + else + try { + result = eval(`(${expr})`); + } catch (t) { + result = expr; + } + return result; + } +} +const Sticky$1 = { + mounted(t, e) { + (typeof e.value > "u" || e.value) && (t[namespace] = new Sticky(t, e.instance), t[namespace].doBind()); + }, + unmounted(t) { + t[namespace] && (t[namespace].doUnbind(), t[namespace] = void 0); + }, + updated(t, e) { + typeof e.value > "u" || e.value ? (t[namespace] || (t[namespace] = new Sticky(t, e.instance)), t[namespace].doBind()) : t[namespace] && t[namespace].doUnbind(); + } +}, StickyPlugin = { + install(t) { + t.directive("Sticky", Sticky$1); + } +}; + + + /***/ }), /***/ "./node_modules/w3c-keyname/index.js": diff --git a/package.json b/package.json index e0d1d8e..c31bda1 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "lodash": "^4.17.21", "lowlight": "^3.1.0", "tippy.js": "^6.3.7", - "tiptap-extension-upload-image": "^1.0.1" + "tiptap-extension-upload-image": "^1.0.1", + "vue3-sticky-directive": "^0.0.2" } } diff --git a/resources/js/components/FormField.vue b/resources/js/components/FormField.vue index 28e099d..4767fe5 100644 --- a/resources/js/components/FormField.vue +++ b/resources/js/components/FormField.vue @@ -8,10 +8,12 @@