@limetech/lime-crm-building-blocks 1.55.6 → 1.55.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/limebb-text-editor.cjs.entry.js +7 -5
- package/dist/collection/components/text-editor/text-editor.js +7 -5
- package/dist/components/limebb-text-editor.js +7 -5
- package/dist/esm/limebb-text-editor.entry.js +7 -5
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-a5f619e8.entry.js +1 -0
- package/dist/types/components/text-editor/text-editor.d.ts +1 -1
- package/package.json +4 -4
- package/dist/lime-crm-building-blocks/p-edbe4b21.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.55.7](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.6...v1.55.7) (2024-12-17)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **text editor:** properly stop and reset trigger when escape key pressed ([fdb950d](https://github.com/Lundalogik/lime-crm-building-blocks/commit/fdb950df380c070dd34697e22c446464e3093722))
|
|
7
|
+
|
|
1
8
|
## [1.55.6](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.5...v1.55.6) (2024-12-12)
|
|
2
9
|
|
|
3
10
|
### Bug Fixes
|
|
@@ -1284,8 +1284,10 @@ const LimeBBTextEditor = class {
|
|
|
1284
1284
|
this.highlightedItemIndex = getItemIndex(event.key, this.highlightedItemIndex, this.items.length);
|
|
1285
1285
|
};
|
|
1286
1286
|
this.handleEscapeKey = () => {
|
|
1287
|
-
|
|
1288
|
-
this
|
|
1287
|
+
var _a;
|
|
1288
|
+
// We only call this when ESCAPE is pressed
|
|
1289
|
+
(_a = this.triggerFunction) === null || _a === void 0 ? void 0 : _a.stopTrigger();
|
|
1290
|
+
this.resetTriggerAndPicker();
|
|
1289
1291
|
};
|
|
1290
1292
|
this.handleEnterOrTabKey = (event) => {
|
|
1291
1293
|
this.handleItemSelection(event);
|
|
@@ -1298,7 +1300,7 @@ const LimeBBTextEditor = class {
|
|
|
1298
1300
|
};
|
|
1299
1301
|
this.handleTriggerStop = (event) => {
|
|
1300
1302
|
event.stopPropagation();
|
|
1301
|
-
this.
|
|
1303
|
+
this.resetTriggerAndPicker();
|
|
1302
1304
|
};
|
|
1303
1305
|
this.handleTriggerChange = (event) => {
|
|
1304
1306
|
event.stopImmediatePropagation();
|
|
@@ -1306,7 +1308,7 @@ const LimeBBTextEditor = class {
|
|
|
1306
1308
|
this.isSearching = true;
|
|
1307
1309
|
this.search();
|
|
1308
1310
|
};
|
|
1309
|
-
this.
|
|
1311
|
+
this.resetTriggerAndPicker = () => {
|
|
1310
1312
|
this.isPickerOpen = false;
|
|
1311
1313
|
this.activeTrigger = undefined;
|
|
1312
1314
|
this.triggerFunction = undefined;
|
|
@@ -1327,7 +1329,7 @@ const LimeBBTextEditor = class {
|
|
|
1327
1329
|
return;
|
|
1328
1330
|
}
|
|
1329
1331
|
this.insertEditorNode(selectedItem);
|
|
1330
|
-
this.
|
|
1332
|
+
this.resetTriggerAndPicker();
|
|
1331
1333
|
(_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1332
1334
|
};
|
|
1333
1335
|
this.insertEditorNode = (item) => {
|
|
@@ -165,8 +165,10 @@ export class LimeBBTextEditor {
|
|
|
165
165
|
this.highlightedItemIndex = getItemIndex(event.key, this.highlightedItemIndex, this.items.length);
|
|
166
166
|
};
|
|
167
167
|
this.handleEscapeKey = () => {
|
|
168
|
-
|
|
169
|
-
this
|
|
168
|
+
var _a;
|
|
169
|
+
// We only call this when ESCAPE is pressed
|
|
170
|
+
(_a = this.triggerFunction) === null || _a === void 0 ? void 0 : _a.stopTrigger();
|
|
171
|
+
this.resetTriggerAndPicker();
|
|
170
172
|
};
|
|
171
173
|
this.handleEnterOrTabKey = (event) => {
|
|
172
174
|
this.handleItemSelection(event);
|
|
@@ -179,7 +181,7 @@ export class LimeBBTextEditor {
|
|
|
179
181
|
};
|
|
180
182
|
this.handleTriggerStop = (event) => {
|
|
181
183
|
event.stopPropagation();
|
|
182
|
-
this.
|
|
184
|
+
this.resetTriggerAndPicker();
|
|
183
185
|
};
|
|
184
186
|
this.handleTriggerChange = (event) => {
|
|
185
187
|
event.stopImmediatePropagation();
|
|
@@ -187,7 +189,7 @@ export class LimeBBTextEditor {
|
|
|
187
189
|
this.isSearching = true;
|
|
188
190
|
this.search();
|
|
189
191
|
};
|
|
190
|
-
this.
|
|
192
|
+
this.resetTriggerAndPicker = () => {
|
|
191
193
|
this.isPickerOpen = false;
|
|
192
194
|
this.activeTrigger = undefined;
|
|
193
195
|
this.triggerFunction = undefined;
|
|
@@ -208,7 +210,7 @@ export class LimeBBTextEditor {
|
|
|
208
210
|
return;
|
|
209
211
|
}
|
|
210
212
|
this.insertEditorNode(selectedItem);
|
|
211
|
-
this.
|
|
213
|
+
this.resetTriggerAndPicker();
|
|
212
214
|
(_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
|
|
213
215
|
};
|
|
214
216
|
this.insertEditorNode = (item) => {
|
|
@@ -1283,8 +1283,10 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1283
1283
|
this.highlightedItemIndex = getItemIndex(event.key, this.highlightedItemIndex, this.items.length);
|
|
1284
1284
|
};
|
|
1285
1285
|
this.handleEscapeKey = () => {
|
|
1286
|
-
|
|
1287
|
-
this
|
|
1286
|
+
var _a;
|
|
1287
|
+
// We only call this when ESCAPE is pressed
|
|
1288
|
+
(_a = this.triggerFunction) === null || _a === void 0 ? void 0 : _a.stopTrigger();
|
|
1289
|
+
this.resetTriggerAndPicker();
|
|
1288
1290
|
};
|
|
1289
1291
|
this.handleEnterOrTabKey = (event) => {
|
|
1290
1292
|
this.handleItemSelection(event);
|
|
@@ -1297,7 +1299,7 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1297
1299
|
};
|
|
1298
1300
|
this.handleTriggerStop = (event) => {
|
|
1299
1301
|
event.stopPropagation();
|
|
1300
|
-
this.
|
|
1302
|
+
this.resetTriggerAndPicker();
|
|
1301
1303
|
};
|
|
1302
1304
|
this.handleTriggerChange = (event) => {
|
|
1303
1305
|
event.stopImmediatePropagation();
|
|
@@ -1305,7 +1307,7 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1305
1307
|
this.isSearching = true;
|
|
1306
1308
|
this.search();
|
|
1307
1309
|
};
|
|
1308
|
-
this.
|
|
1310
|
+
this.resetTriggerAndPicker = () => {
|
|
1309
1311
|
this.isPickerOpen = false;
|
|
1310
1312
|
this.activeTrigger = undefined;
|
|
1311
1313
|
this.triggerFunction = undefined;
|
|
@@ -1326,7 +1328,7 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1326
1328
|
return;
|
|
1327
1329
|
}
|
|
1328
1330
|
this.insertEditorNode(selectedItem);
|
|
1329
|
-
this.
|
|
1331
|
+
this.resetTriggerAndPicker();
|
|
1330
1332
|
(_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1331
1333
|
};
|
|
1332
1334
|
this.insertEditorNode = (item) => {
|
|
@@ -1280,8 +1280,10 @@ const LimeBBTextEditor = class {
|
|
|
1280
1280
|
this.highlightedItemIndex = getItemIndex(event.key, this.highlightedItemIndex, this.items.length);
|
|
1281
1281
|
};
|
|
1282
1282
|
this.handleEscapeKey = () => {
|
|
1283
|
-
|
|
1284
|
-
this
|
|
1283
|
+
var _a;
|
|
1284
|
+
// We only call this when ESCAPE is pressed
|
|
1285
|
+
(_a = this.triggerFunction) === null || _a === void 0 ? void 0 : _a.stopTrigger();
|
|
1286
|
+
this.resetTriggerAndPicker();
|
|
1285
1287
|
};
|
|
1286
1288
|
this.handleEnterOrTabKey = (event) => {
|
|
1287
1289
|
this.handleItemSelection(event);
|
|
@@ -1294,7 +1296,7 @@ const LimeBBTextEditor = class {
|
|
|
1294
1296
|
};
|
|
1295
1297
|
this.handleTriggerStop = (event) => {
|
|
1296
1298
|
event.stopPropagation();
|
|
1297
|
-
this.
|
|
1299
|
+
this.resetTriggerAndPicker();
|
|
1298
1300
|
};
|
|
1299
1301
|
this.handleTriggerChange = (event) => {
|
|
1300
1302
|
event.stopImmediatePropagation();
|
|
@@ -1302,7 +1304,7 @@ const LimeBBTextEditor = class {
|
|
|
1302
1304
|
this.isSearching = true;
|
|
1303
1305
|
this.search();
|
|
1304
1306
|
};
|
|
1305
|
-
this.
|
|
1307
|
+
this.resetTriggerAndPicker = () => {
|
|
1306
1308
|
this.isPickerOpen = false;
|
|
1307
1309
|
this.activeTrigger = undefined;
|
|
1308
1310
|
this.triggerFunction = undefined;
|
|
@@ -1323,7 +1325,7 @@ const LimeBBTextEditor = class {
|
|
|
1323
1325
|
return;
|
|
1324
1326
|
}
|
|
1325
1327
|
this.insertEditorNode(selectedItem);
|
|
1326
|
-
this.
|
|
1328
|
+
this.resetTriggerAndPicker();
|
|
1327
1329
|
(_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1328
1330
|
};
|
|
1329
1331
|
this.insertEditorNode = (item) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-4b389d50",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],heading:[1],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-4b389d50",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],heading:[1],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-a5f619e8",[[1,"limebb-text-editor",{platform:[16],context:[16],allowMentioning:[4,"allow-mentioning"],contentType:[1,"content-type"],language:[513],disabled:[516],readonly:[516],helperText:[513,"helper-text"],placeholder:[513],label:[513],invalid:[516],required:[516],selectedContext:[16],ui:[513],allowResize:[4,"allow-resize"],value:[1],items:[32],highlightedItemIndex:[32],customElements:[32],registeredTriggers:[32],editorPickerQuery:[32],searchableLimetypes:[32],isPickerOpen:[32],isSearching:[32]}]]],["p-2e549d89",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-beb4e864",[[1,"limebb-info-tile-currency-format",{platform:[16],context:[16],value:[16]}]]],["p-56654f3d",[[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-c4e176ca",[[17,"limebb-browser",{platform:[16],context:[16],items:[16],layout:[1],filter:[32]}]]],["p-dc97e968",[[1,"limebb-component-config",{platform:[16],context:[16],value:[16],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],formInfo:[16],type:[1],nameField:[1,"name-field"],configComponent:[32],configViewType:[32]}]]],["p-3f66a22e",[[1,"limebb-component-picker",{platform:[16],context:[16],type:[1],tags:[16],value:[1],copyLabel:[1,"copy-label"],hideCopyButton:[4,"hide-copy-button"],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-74dfea73",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-8aafd8fb",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-949f5146",[[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32]}]]],["p-3602eb38",[[1,"limebb-info-tile-date-format",{value:[16]}]]],["p-87d08f0d",[[1,"limebb-info-tile-decimal-format",{value:[16]}]]],["p-2867f980",[[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]]],["p-c163374e",[[1,"limebb-info-tile-relative-date-format",{value:[16]}]]],["p-d0a17301",[[1,"limebb-info-tile-unit-format",{value:[16]}]]],["p-58416605",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-1acd64f5",[[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]]],["p-6abd79e1",[[1,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]]],["p-25011706",[[17,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-fd6bc5af",[[1,"limebb-kanban-column",{platform:[16],context:[16],columnHeading:[1,"column-heading"],items:[16],loading:[4],paginationSize:[2,"pagination-size"],displayedItemCount:[32]}]]],["p-7cd87ebd",[[1,"limebb-text-editor-picker",{items:[16],open:[516],isSearching:[4,"is-searching"],emptyMessage:[1,"empty-message"]}]]],["p-99a45f29",[[1,"limebb-currency-picker",{platform:[16],context:[16],label:[513],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[1]}]]],["p-bf3dfc8b",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-abdc6601",[[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],ui:[513],isBundled:[516,"is-bundled"],headingCanExpand:[32],isHeadingExpanded:[32],showMore:[32],isTall:[32]}]]],["p-39b80f7a",[[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]]],["p-9e9e54f3",[[1,"limebb-kanban-item",{platform:[16],context:[16],item:[16]}]]],["p-b4e15af7",[[1,"limebb-empty-state",{heading:[513],value:[513],icon:[16]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,g as r}from"./p-8e85017b.js";import{P as n}from"./p-4506e883.js";import{a as s}from"./p-db4425f5.js";import{A as o,a,b as c,E as u,T as h}from"./p-0086e532.js";import{d as f,b as v,k as d,c as l,s as b,a as p,e as m,U as j,S as y,g}from"./p-ef494ab2.js";import{i as w,e as O}from"./p-28e4e638.js";import{d as x,r as k,S as A,a as S,i as T}from"./p-e7281662.js";import{d as M,i as E,o as N,g as I,h as _,n as C,a as F}from"./p-f340c7e6.js";import{i as P}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";var R=/\s/,$=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,L=/^0o[0-7]+$/i,Q=parseInt;function W(t){if("number"==typeof t)return t;if(w(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;var i;t=(i=t)?i.slice(0,function(t){for(var e=t.length;e--&&R.test(t.charAt(e)););return e}(i)+1).replace($,""):i;var r=D.test(t);return r||L.test(t)?Q(t.slice(2),r?2:8):U.test(t)?NaN:+t}var B=Object.create,q=function(){function t(){}return function(e){if(!x(e))return{};if(B)return B(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();function z(t,e,i){"__proto__"==e&&f?f(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}var G=Object.prototype.hasOwnProperty;function H(t,e,i){var r=t[e];G.call(t,e)&&O(r,i)&&(void 0!==i||e in t)||z(t,e,i)}function K(t,e,i,r){var n=!i;i||(i={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=r?r(i[a],t[a],a,i,t):void 0;void 0===c&&(c=t[a]),n?z(i,a,c):H(i,a,c)}return i}var V=Object.prototype.hasOwnProperty;function J(t){return E(t)?v(t,!0):function(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}(t);var e=M(t),i=[];for(var r in t)("constructor"!=r||!e&&V.call(t,r))&&i.push(r);return i}(t)}var X=N(Object.getPrototypeOf,Object),Y="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=Y&&"object"==typeof module&&module&&!module.nodeType&&module,tt=Z&&Z.exports===Y?k.Buffer:void 0,et=tt?tt.allocUnsafe:void 0,it=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)p(e,l(t)),t=X(t);return e}:b;function rt(t){return m(t,J,it)}var nt=Object.prototype.hasOwnProperty;function st(t){var e=new t.constructor(t.byteLength);return new j(e).set(new j(t)),e}var ot=/\w*$/,at=A?A.prototype:void 0,ct=at?at.valueOf:void 0;var ut=C&&C.isMap,ht=ut?_(ut):function(t){return S(t)&&"[object Map]"==I(t)},ft=C&&C.isSet,vt=ft?_(ft):function(t){return S(t)&&"[object Set]"==I(t)},dt={};function lt(t,e,i,r,n,s){var o,a=1&e,c=2&e,u=4&e;if(i&&(o=n?i(t,r,n,s):i(t)),void 0!==o)return o;if(!x(t))return t;var h=T(t);if(h){if(o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&nt.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!a)return function(t,e){var i=-1,r=t.length;for(e||(e=Array(r));++i<r;)e[i]=t[i];return e}(t,o)}else{var f=I(t),v="[object Function]"==f||"[object GeneratorFunction]"==f;if(F(t))return function(t,e){if(e)return t.slice();var i=t.length,r=et?et(i):new t.constructor(i);return t.copy(r),r}(t,a);if("[object Object]"==f||"[object Arguments]"==f||v&&!n){if(o=c||v?{}:function(t){return"function"!=typeof t.constructor||M(t)?{}:q(X(t))}(t),!a)return c?function(t,e){return K(t,it(t),e)}(t,function(t,e){return t&&K(e,J(e),t)}(o,t)):function(t,e){return K(t,l(t),e)}(t,function(t,e){return t&&K(e,d(e),t)}(o,t))}else{if(!dt[f])return n?t:{};o=function(t,e,i){var r,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return st(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var i=e?st(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var i=e?st(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(r=t).constructor(r.source,ot.exec(r))).lastIndex=r.lastIndex,n;case"[object Set]":return new s;case"[object Symbol]":return ct?Object(ct.call(t)):{}}}(t,f,a)}}s||(s=new y);var b=s.get(t);if(b)return b;s.set(t,o),vt(t)?t.forEach((function(r){o.add(lt(r,e,i,r,t,s))})):ht(t)&&t.forEach((function(r,n){o.set(n,lt(r,e,i,n,t,s))}));var p=h?void 0:(u?c?rt:g:c?J:d)(t);return function(t,e){for(var i=-1,r=null==t?0:t.length;++i<r&&!1!==e(t[i],i););}(p||t,(function(r,n){p&&(r=t[n=r]),H(o,n,lt(r,e,i,n,t,s))})),o}dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object DataView]"]=dt["[object Boolean]"]=dt["[object Date]"]=dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object Symbol]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Error]"]=dt["[object Function]"]=dt["[object WeakMap]"]=!1;var bt=function(){return k.Date.now()},pt=Math.max,mt=Math.min;const jt=class{constructor(i){var r;t(this,i),this.change=e(this,"change",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.items=[],this.highlightedItemIndex=0,this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.isSearching=!1,this.activeTrigger=void 0,this.triggerMap={"@":{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![a,c,o,u,h].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[a]:this.handleEscapeKey,[u]:this.handleEnterOrTabKey,[h]:this.handleEnterOrTabKey,[o]:this.handleArrowKeyPress,[c]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{var e;this.highlightedItemIndex=(this.highlightedItemIndex+(t.key===o?1:-1)+(e=this.items.length))%e},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.isSearching=!0,this.search()},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var e;let i;if(t instanceof CustomEvent)i=t.detail;else{if(!(t instanceof KeyboardEvent))return;i=this.items[this.highlightedItemIndex]}this.insertEditorNode(i),this.resetTriggerAndPicker(),null===(e=this.textEditor)||void 0===e||e.focus()},this.insertEditorNode=t=>{var e,i;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const r=this.triggerMap[this.activeTrigger];try{null===(e=this.triggerFunction)||void 0===e||e.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(t)},children:[null===(i=t.value)||void 0===i?void 0:i.descriptive]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(r=window.crypto)||void 0===r?void 0:r.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2),this.search=function(t,e,i){var r,n,s,o,a,c,u=0,h=!1,f=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var i=r,s=n;return r=n=void 0,u=e,o=t.apply(s,i)}function l(t){return u=t,a=setTimeout(p,e),h?d(t):o}function b(t){var i=t-c;return void 0===c||i>=e||i<0||f&&t-u>=s}function p(){var t=bt();if(b(t))return m(t);a=setTimeout(p,function(t){var i=e-(t-c);return f?mt(i,s-(t-u)):i}(t))}function m(t){return a=void 0,v&&r?d(t):(r=n=void 0,o)}function j(){var t=bt(),i=b(t);if(r=arguments,n=this,c=t,i){if(void 0===a)return l(c);if(f)return clearTimeout(a),a=setTimeout(p,e),d(c)}return void 0===a&&(a=setTimeout(p,e)),o}return e=W(e)||0,x(i)&&(h=!!i.leading,s=(f="maxWait"in i)?pt(W(i.maxWait)||0,e):s,v="trailing"in i?!!i.trailing:v),j.cancel=function(){void 0!==a&&clearTimeout(a),u=0,r=c=n=a=void 0},j.flush=function(){return void 0===a?o:m(bt())},j}(this.search,300)}watchOpen(){this.setupHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}disconnectedCallback(){this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}setCustomElementsAndTriggers(){this.customElements=Object.values(this.triggerMap).map((t=>t.customElement)),this.allowMentioning&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0})):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}render(){return[i("limel-text-editor",{ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.customElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return i("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},i("limebb-text-editor-picker",{items:(t=this.items,e=this.highlightedItemIndex,t.map(((t,i)=>{const r=lt(t,5);return Object.assign(Object.assign({},r),{selected:i===e})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,e}async search(){if(!this.limeObjectService)return void(this.isSearching=!1);if(!this.editorPickerQuery)return this.items=[],void(this.isSearching=!1);const t=this.editorPickerQuery;try{const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);if(t!==this.editorPickerQuery)return;if(this.isSearching=!1,!e.length)return void(this.items=[]);if(!this.activeTrigger)return;this.items=this.createSearchListItems(e)}catch(t){console.error("Failed search for user",t)}}createSearchListItems(t=[]){const e=this.viewFactoryRegistry.getFactory("search");return t.map((t=>{const i=this.limeObjectService.getObject(t._limetype,t._id);return i?e(i,this.context):null})).filter(P)}get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get host(){return r(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);s>3&&o&&Object.defineProperty(e,i,o)}([s({map:[function(t){return Object.values(t).filter((t=>"user"===t.label||function(t){const e=function(t){return Object.values(t.properties).find((t=>{var e,i;return"user"===(null===(i=null===(e=null==t?void 0:t.relation)||void 0===e?void 0:e.getLimetype())||void 0===i?void 0:i.label)}))}(t);return!!e&&(function(t){return t&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(t.type)}(i=e)&&!function(t){return t&&["belongsto","hasone"].includes(t.type)}(i))&&("user",!("user"===t.label));var i}(t)))}]})],jt.prototype,"searchableLimetypes",void 0);export{jt as limebb_text_editor}
|
|
@@ -158,7 +158,7 @@ export declare class LimeBBTextEditor implements FormComponent<string> {
|
|
|
158
158
|
private handleTriggerStart;
|
|
159
159
|
private handleTriggerStop;
|
|
160
160
|
private handleTriggerChange;
|
|
161
|
-
private
|
|
161
|
+
private resetTriggerAndPicker;
|
|
162
162
|
private handleItemSelection;
|
|
163
163
|
private search;
|
|
164
164
|
private createSearchListItems;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-crm-building-blocks",
|
|
3
|
-
"version": "1.55.
|
|
3
|
+
"version": "1.55.7",
|
|
4
4
|
"description": "A home for shared components meant for use with Lime CRM",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@eslint/eslintrc": "^3.2.0",
|
|
45
|
-
"@eslint/js": "^9.
|
|
46
|
-
"@limetech/lime-elements": "^37.76.
|
|
45
|
+
"@eslint/js": "^9.17.0",
|
|
46
|
+
"@limetech/lime-elements": "^37.76.2",
|
|
47
47
|
"@limetech/lime-web-components": "^5.41.0",
|
|
48
48
|
"@lundalogik/lime-icons8": "^2.30.1",
|
|
49
|
-
"@lundalogik/limeclient.js": "^1.
|
|
49
|
+
"@lundalogik/limeclient.js": "^1.74.0",
|
|
50
50
|
"@stencil/core": "<2.19.0",
|
|
51
51
|
"@stencil/sass": "^3.0.12",
|
|
52
52
|
"@types/jest": "^27.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,g as r}from"./p-8e85017b.js";import{P as n}from"./p-4506e883.js";import{a as s}from"./p-db4425f5.js";import{A as o,a,b as c,E as u,T as h}from"./p-0086e532.js";import{d as f,b as v,k as d,c as l,s as b,a as p,e as m,U as j,S as y,g}from"./p-ef494ab2.js";import{i as w,e as O}from"./p-28e4e638.js";import{d as x,r as k,S as A,a as S,i as T}from"./p-e7281662.js";import{d as M,i as E,o as N,g as I,h as _,n as C,a as F}from"./p-f340c7e6.js";import{i as P}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";var R=/\s/,$=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,L=/^0o[0-7]+$/i,Q=parseInt;function W(t){if("number"==typeof t)return t;if(w(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;var i;t=(i=t)?i.slice(0,function(t){for(var e=t.length;e--&&R.test(t.charAt(e)););return e}(i)+1).replace($,""):i;var r=D.test(t);return r||L.test(t)?Q(t.slice(2),r?2:8):U.test(t)?NaN:+t}var B=Object.create,q=function(){function t(){}return function(e){if(!x(e))return{};if(B)return B(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();function z(t,e,i){"__proto__"==e&&f?f(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}var G=Object.prototype.hasOwnProperty;function H(t,e,i){var r=t[e];G.call(t,e)&&O(r,i)&&(void 0!==i||e in t)||z(t,e,i)}function K(t,e,i,r){var n=!i;i||(i={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=r?r(i[a],t[a],a,i,t):void 0;void 0===c&&(c=t[a]),n?z(i,a,c):H(i,a,c)}return i}var V=Object.prototype.hasOwnProperty;function J(t){return E(t)?v(t,!0):function(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}(t);var e=M(t),i=[];for(var r in t)("constructor"!=r||!e&&V.call(t,r))&&i.push(r);return i}(t)}var X=N(Object.getPrototypeOf,Object),Y="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=Y&&"object"==typeof module&&module&&!module.nodeType&&module,tt=Z&&Z.exports===Y?k.Buffer:void 0,et=tt?tt.allocUnsafe:void 0,it=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)p(e,l(t)),t=X(t);return e}:b;function rt(t){return m(t,J,it)}var nt=Object.prototype.hasOwnProperty;function st(t){var e=new t.constructor(t.byteLength);return new j(e).set(new j(t)),e}var ot=/\w*$/,at=A?A.prototype:void 0,ct=at?at.valueOf:void 0;var ut=C&&C.isMap,ht=ut?_(ut):function(t){return S(t)&&"[object Map]"==I(t)},ft=C&&C.isSet,vt=ft?_(ft):function(t){return S(t)&&"[object Set]"==I(t)},dt={};function lt(t,e,i,r,n,s){var o,a=1&e,c=2&e,u=4&e;if(i&&(o=n?i(t,r,n,s):i(t)),void 0!==o)return o;if(!x(t))return t;var h=T(t);if(h){if(o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&nt.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!a)return function(t,e){var i=-1,r=t.length;for(e||(e=Array(r));++i<r;)e[i]=t[i];return e}(t,o)}else{var f=I(t),v="[object Function]"==f||"[object GeneratorFunction]"==f;if(F(t))return function(t,e){if(e)return t.slice();var i=t.length,r=et?et(i):new t.constructor(i);return t.copy(r),r}(t,a);if("[object Object]"==f||"[object Arguments]"==f||v&&!n){if(o=c||v?{}:function(t){return"function"!=typeof t.constructor||M(t)?{}:q(X(t))}(t),!a)return c?function(t,e){return K(t,it(t),e)}(t,function(t,e){return t&&K(e,J(e),t)}(o,t)):function(t,e){return K(t,l(t),e)}(t,function(t,e){return t&&K(e,d(e),t)}(o,t))}else{if(!dt[f])return n?t:{};o=function(t,e,i){var r,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return st(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var i=e?st(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var i=e?st(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(r=t).constructor(r.source,ot.exec(r))).lastIndex=r.lastIndex,n;case"[object Set]":return new s;case"[object Symbol]":return ct?Object(ct.call(t)):{}}}(t,f,a)}}s||(s=new y);var b=s.get(t);if(b)return b;s.set(t,o),vt(t)?t.forEach((function(r){o.add(lt(r,e,i,r,t,s))})):ht(t)&&t.forEach((function(r,n){o.set(n,lt(r,e,i,n,t,s))}));var p=h?void 0:(u?c?rt:g:c?J:d)(t);return function(t,e){for(var i=-1,r=null==t?0:t.length;++i<r&&!1!==e(t[i],i););}(p||t,(function(r,n){p&&(r=t[n=r]),H(o,n,lt(r,e,i,n,t,s))})),o}dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object DataView]"]=dt["[object Boolean]"]=dt["[object Date]"]=dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object Symbol]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Error]"]=dt["[object Function]"]=dt["[object WeakMap]"]=!1;var bt=function(){return k.Date.now()},pt=Math.max,mt=Math.min;const jt=class{constructor(i){var r;t(this,i),this.change=e(this,"change",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.items=[],this.highlightedItemIndex=0,this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.isSearching=!1,this.activeTrigger=void 0,this.triggerMap={"@":{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![a,c,o,u,h].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[a]:this.handleEscapeKey,[u]:this.handleEnterOrTabKey,[h]:this.handleEnterOrTabKey,[o]:this.handleArrowKeyPress,[c]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{var e;this.highlightedItemIndex=(this.highlightedItemIndex+(t.key===o?1:-1)+(e=this.items.length))%e},this.handleEscapeKey=()=>{this.isPickerOpen=!1,this.stopTrigger()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.stopTrigger()},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.isSearching=!0,this.search()},this.stopTrigger=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var e;let i;if(t instanceof CustomEvent)i=t.detail;else{if(!(t instanceof KeyboardEvent))return;i=this.items[this.highlightedItemIndex]}this.insertEditorNode(i),this.stopTrigger(),null===(e=this.textEditor)||void 0===e||e.focus()},this.insertEditorNode=t=>{var e,i;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const r=this.triggerMap[this.activeTrigger];try{null===(e=this.triggerFunction)||void 0===e||e.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(t)},children:[null===(i=t.value)||void 0===i?void 0:i.descriptive]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(r=window.crypto)||void 0===r?void 0:r.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2),this.search=function(t,e,i){var r,n,s,o,a,c,u=0,h=!1,f=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var i=r,s=n;return r=n=void 0,u=e,o=t.apply(s,i)}function l(t){return u=t,a=setTimeout(p,e),h?d(t):o}function b(t){var i=t-c;return void 0===c||i>=e||i<0||f&&t-u>=s}function p(){var t=bt();if(b(t))return m(t);a=setTimeout(p,function(t){var i=e-(t-c);return f?mt(i,s-(t-u)):i}(t))}function m(t){return a=void 0,v&&r?d(t):(r=n=void 0,o)}function j(){var t=bt(),i=b(t);if(r=arguments,n=this,c=t,i){if(void 0===a)return l(c);if(f)return clearTimeout(a),a=setTimeout(p,e),d(c)}return void 0===a&&(a=setTimeout(p,e)),o}return e=W(e)||0,x(i)&&(h=!!i.leading,s=(f="maxWait"in i)?pt(W(i.maxWait)||0,e):s,v="trailing"in i?!!i.trailing:v),j.cancel=function(){void 0!==a&&clearTimeout(a),u=0,r=c=n=a=void 0},j.flush=function(){return void 0===a?o:m(bt())},j}(this.search,300)}watchOpen(){this.setupHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}disconnectedCallback(){this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}setCustomElementsAndTriggers(){this.customElements=Object.values(this.triggerMap).map((t=>t.customElement)),this.allowMentioning&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0})):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}render(){return[i("limel-text-editor",{ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.customElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return i("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},i("limebb-text-editor-picker",{items:(t=this.items,e=this.highlightedItemIndex,t.map(((t,i)=>{const r=lt(t,5);return Object.assign(Object.assign({},r),{selected:i===e})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,e}async search(){if(!this.limeObjectService)return void(this.isSearching=!1);if(!this.editorPickerQuery)return this.items=[],void(this.isSearching=!1);const t=this.editorPickerQuery;try{const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);if(t!==this.editorPickerQuery)return;if(this.isSearching=!1,!e.length)return void(this.items=[]);if(!this.activeTrigger)return;this.items=this.createSearchListItems(e)}catch(t){console.error("Failed search for user",t)}}createSearchListItems(t=[]){const e=this.viewFactoryRegistry.getFactory("search");return t.map((t=>{const i=this.limeObjectService.getObject(t._limetype,t._id);return i?e(i,this.context):null})).filter(P)}get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get host(){return r(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);s>3&&o&&Object.defineProperty(e,i,o)}([s({map:[function(t){return Object.values(t).filter((t=>"user"===t.label||function(t){const e=function(t){return Object.values(t.properties).find((t=>{var e,i;return"user"===(null===(i=null===(e=null==t?void 0:t.relation)||void 0===e?void 0:e.getLimetype())||void 0===i?void 0:i.label)}))}(t);return!!e&&(function(t){return t&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(t.type)}(i=e)&&!function(t){return t&&["belongsto","hasone"].includes(t.type)}(i))&&("user",!("user"===t.label));var i}(t)))}]})],jt.prototype,"searchableLimetypes",void 0);export{jt as limebb_text_editor}
|