@limetech/lime-crm-building-blocks 1.71.1 → 1.72.1
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 +17 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-icon-picker.cjs.entry.js +5 -0
- package/dist/cjs/limebb-text-editor.cjs.entry.js +188 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/text-editor/text-editor.js +125 -1
- package/dist/collection/components/text-editor/uploader/building-blocks-upload-handler.js +87 -0
- package/dist/collection/components/text-editor/uploader/building-blocks-uploader.js +38 -0
- package/dist/components/limebb-icon-picker.js +5 -0
- package/dist/components/limebb-text-editor.js +189 -1
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-icon-picker.entry.js +5 -0
- package/dist/esm/limebb-text-editor.entry.js +188 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-38e46f6a.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-cafb01ea.entry.js → p-aeac0ae8.entry.js} +1 -1
- package/dist/types/components/text-editor/text-editor.d.ts +44 -1
- package/dist/types/components/text-editor/uploader/building-blocks-upload-handler.d.ts +30 -0
- package/dist/types/components/text-editor/uploader/building-blocks-uploader.d.ts +31 -0
- package/dist/types/components.d.ts +27 -2
- package/package.json +3 -3
- package/dist/lime-crm-building-blocks/p-30bde807.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [1.72.1](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.72.0...v1.72.1) (2025-04-24)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **text-editor:** emit imagesUploading event when images are removed ([b963fa9](https://github.com/Lundalogik/lime-crm-building-blocks/commit/b963fa924ccb9cdfdda79ef278d423b6c8422782))
|
|
7
|
+
|
|
8
|
+
## [1.72.0](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.71.1...v1.72.0) (2025-04-23)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
* **text editor:** add allow images prop and update event doc strings ([d09314a](https://github.com/Lundalogik/lime-crm-building-blocks/commit/d09314a9d829b1a9a97b12495261779d9af4693b))
|
|
14
|
+
* **text editor:** add file upload handler ([c4a6754](https://github.com/Lundalogik/lime-crm-building-blocks/commit/c4a67544defc36464ec34859c7cbdd044982cfb1))
|
|
15
|
+
* **text editor:** add file uploader class ([54d2796](https://github.com/Lundalogik/lime-crm-building-blocks/commit/54d27961ac00f07f1b547c67aef9d7e04d87a140))
|
|
16
|
+
* **text editor:** use file upload in text editor ([34fde63](https://github.com/Lundalogik/lime-crm-building-blocks/commit/34fde6379812354d06fe993e1cd91aff521cc8b0))
|
|
17
|
+
|
|
1
18
|
## [1.71.1](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.71.0...v1.71.1) (2025-04-23)
|
|
2
19
|
|
|
3
20
|
### Bug Fixes
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["limebb-feed.cjs",[[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"],"direction":[1],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["limebb-chat-list.cjs",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["limebb-text-editor.cjs",[[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],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["limebb-date-range.cjs",[[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]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[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]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["limebb-component-picker.cjs",[[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"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[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]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[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]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-mention-group-counter.cjs",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["limebb-trend-indicator.cjs",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["limebb-navigation-button_2.cjs",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-group.cjs",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["limebb-feed-timeline-item.cjs",[[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]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["limebb-currency-picker.cjs",[[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]}]]],["limebb-date-picker.cjs",[[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]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-chat-item_2.cjs",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16]}],[1,"limebb-typing-indicator"]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["limebb-feed.cjs",[[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"],"direction":[1],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["limebb-chat-list.cjs",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["limebb-text-editor.cjs",[[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],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["limebb-date-range.cjs",[[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]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[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]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["limebb-component-picker.cjs",[[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"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[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]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[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]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-mention-group-counter.cjs",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["limebb-trend-indicator.cjs",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["limebb-navigation-button_2.cjs",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-group.cjs",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["limebb-feed-timeline-item.cjs",[[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]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["limebb-currency-picker.cjs",[[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]}]]],["limebb-date-picker.cjs",[[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]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-chat-item_2.cjs",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16]}],[1,"limebb-typing-indicator"]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -25014,6 +25014,11 @@ const icons = [
|
|
|
25014
25014
|
id: "-lime-app-icon-bi.svg",
|
|
25015
25015
|
tags: [
|
|
25016
25016
|
]
|
|
25017
|
+
},
|
|
25018
|
+
{
|
|
25019
|
+
id: "-lime-stop-filled.svg",
|
|
25020
|
+
tags: [
|
|
25021
|
+
]
|
|
25017
25022
|
}
|
|
25018
25023
|
];
|
|
25019
25024
|
|
|
@@ -35,6 +35,20 @@ function isSingleRelation(property) {
|
|
|
35
35
|
return property && propTypes.includes(property.type);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Defines the HTTP methods as constants.
|
|
40
|
+
* Used in the UploadFile class in lime-crm-components
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
const HttpMethod = {
|
|
45
|
+
Get: 'GET',
|
|
46
|
+
Post: 'POST',
|
|
47
|
+
Put: 'PUT',
|
|
48
|
+
Delete: 'DELETE',
|
|
49
|
+
Patch: 'PATCH',
|
|
50
|
+
};
|
|
51
|
+
|
|
38
52
|
/** Used to match a single whitespace character. */
|
|
39
53
|
var reWhitespace = /\s/;
|
|
40
54
|
|
|
@@ -1340,6 +1354,130 @@ class MentionsService {
|
|
|
1340
1354
|
}
|
|
1341
1355
|
}
|
|
1342
1356
|
|
|
1357
|
+
const CORE_API_PATH = 'api/v1';
|
|
1358
|
+
const FILE_PATH = 'file';
|
|
1359
|
+
const FIFTY = 50;
|
|
1360
|
+
const THOUSAND_BYTES = 1024;
|
|
1361
|
+
const MAX_FILE_SIZE = FIFTY * THOUSAND_BYTES * THOUSAND_BYTES; // 50 MB
|
|
1362
|
+
class FileUpload {
|
|
1363
|
+
constructor(file, http) {
|
|
1364
|
+
this.file = file;
|
|
1365
|
+
this.http = http;
|
|
1366
|
+
this.uploadCancelled = false;
|
|
1367
|
+
this.getUrl = (fileid) => {
|
|
1368
|
+
return `${CORE_API_PATH}/${FILE_PATH}/${fileid ? fileid : ''}`;
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
async initialize() {
|
|
1372
|
+
this.uploadService = await this.http.createFileUpload(HttpMethod.Post, this.getUrl(), this.file);
|
|
1373
|
+
if (this.progressCallback) {
|
|
1374
|
+
this.uploadService.onProgress = this.progressCallback;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
async upload() {
|
|
1378
|
+
return this.uploadService.upload();
|
|
1379
|
+
}
|
|
1380
|
+
getFileName() {
|
|
1381
|
+
return this.file.name;
|
|
1382
|
+
}
|
|
1383
|
+
cancel() {
|
|
1384
|
+
this.uploadService.cancel();
|
|
1385
|
+
this.uploadCancelled = true;
|
|
1386
|
+
}
|
|
1387
|
+
set onProgress(callback) {
|
|
1388
|
+
this.progressCallback = callback;
|
|
1389
|
+
if (this.uploadService) {
|
|
1390
|
+
this.uploadService.onProgress = callback;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
const UPLOAD_COMPLETED = 100;
|
|
1396
|
+
class UploadHandler {
|
|
1397
|
+
constructor(platform) {
|
|
1398
|
+
this.platform = platform;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Handles image paste events in the text editor
|
|
1402
|
+
*
|
|
1403
|
+
* @param {ImageInserter} imageInserter - The image inserter with the file info
|
|
1404
|
+
* @returns {Promise<FileWrapper | undefined>} Promise resolving to the uploaded file wrapper or undefined if upload fails
|
|
1405
|
+
*/
|
|
1406
|
+
async handleImagePasted(imageInserter) {
|
|
1407
|
+
const fileInfo = imageInserter === null || imageInserter === void 0 ? void 0 : imageInserter.fileInfo;
|
|
1408
|
+
if (!fileInfo) {
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
if (!this.validateImageSize(fileInfo)) {
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
imageInserter.insertThumbnail();
|
|
1415
|
+
const uploadedFile = await this.createFileUpload(fileInfo);
|
|
1416
|
+
const fileUrl = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.href;
|
|
1417
|
+
const fileId = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId;
|
|
1418
|
+
if (fileUrl && fileId !== undefined) {
|
|
1419
|
+
imageInserter.insertImage(fileUrl);
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
imageInserter.insertFailedThumbnail();
|
|
1423
|
+
}
|
|
1424
|
+
return uploadedFile;
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Validates that the image file size is within limits
|
|
1428
|
+
*
|
|
1429
|
+
* @param {FileInfo} fileInfo - The file info to validate
|
|
1430
|
+
* @returns {boolean} True if file size is valid, false otherwise
|
|
1431
|
+
*/
|
|
1432
|
+
validateImageSize(fileInfo) {
|
|
1433
|
+
if (!fileInfo.fileContent) {
|
|
1434
|
+
return false;
|
|
1435
|
+
}
|
|
1436
|
+
return fileInfo.fileContent.size <= MAX_FILE_SIZE;
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Creates and uploads a file
|
|
1440
|
+
*
|
|
1441
|
+
* @param {FileInfo} fileInfo - The file info to upload
|
|
1442
|
+
* @returns {Promise<FileWrapper | undefined>} Promise resolving to the uploaded file wrapper or undefined if upload fails
|
|
1443
|
+
*/
|
|
1444
|
+
async createFileUpload(fileInfo) {
|
|
1445
|
+
var _a;
|
|
1446
|
+
if (!fileInfo.fileContent) {
|
|
1447
|
+
return;
|
|
1448
|
+
}
|
|
1449
|
+
const imageFile = new FileUpload(fileInfo.fileContent, this.http);
|
|
1450
|
+
await imageFile.initialize();
|
|
1451
|
+
const imageUpload = Object.assign(Object.assign({}, fileInfo), { progress: 0, file: imageFile, state: 'added', fileId: undefined, href: undefined, fileInfoId: fileInfo.id });
|
|
1452
|
+
imageFile.onProgress = (progress) => {
|
|
1453
|
+
if (imageUpload.progress === 0) {
|
|
1454
|
+
imageUpload.state = 'uploading';
|
|
1455
|
+
}
|
|
1456
|
+
imageUpload.progress = progress;
|
|
1457
|
+
if (progress === UPLOAD_COMPLETED) {
|
|
1458
|
+
imageUpload.state = 'finalizing';
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
const response = await imageFile.upload();
|
|
1462
|
+
// FileWrapper wraps the FileStatus type, which wraps the FileInfo interface
|
|
1463
|
+
// 'id' is the file id property on the FileInfo interface
|
|
1464
|
+
// 'fileId' is the file id property on the FileStatus type
|
|
1465
|
+
imageUpload.id = response.id;
|
|
1466
|
+
imageUpload.fileId = response.id;
|
|
1467
|
+
imageUpload.filename = response.filename;
|
|
1468
|
+
imageUpload.extension = response.extension;
|
|
1469
|
+
imageUpload.contentType = response.contentType;
|
|
1470
|
+
imageUpload.size = response.size;
|
|
1471
|
+
imageUpload.state = 'done';
|
|
1472
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1473
|
+
imageUpload.href = (_a = response._links) === null || _a === void 0 ? void 0 : _a.contents.href;
|
|
1474
|
+
return imageUpload;
|
|
1475
|
+
}
|
|
1476
|
+
get http() {
|
|
1477
|
+
return this.platform.get(types.PlatformServiceName.Http);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1343
1481
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1344
1482
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1345
1483
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1362,6 +1500,9 @@ const LimeBBTextEditor = class {
|
|
|
1362
1500
|
constructor(hostRef) {
|
|
1363
1501
|
index.registerInstance(this, hostRef);
|
|
1364
1502
|
this.change = index.createEvent(this, "change", 7);
|
|
1503
|
+
this.imageUploaded = index.createEvent(this, "imageUploaded", 7);
|
|
1504
|
+
this.imageRemoved = index.createEvent(this, "imageRemoved", 7);
|
|
1505
|
+
this.imagesUploading = index.createEvent(this, "imagesUploading", 7);
|
|
1365
1506
|
/**
|
|
1366
1507
|
* Set to true to enable mentioning a coworker or groups of coworkers.
|
|
1367
1508
|
*
|
|
@@ -1429,6 +1570,17 @@ const LimeBBTextEditor = class {
|
|
|
1429
1570
|
this.value = '';
|
|
1430
1571
|
this.triggerMap = {};
|
|
1431
1572
|
this.customElements = [];
|
|
1573
|
+
/**
|
|
1574
|
+
* Enables image pasting in the editor.
|
|
1575
|
+
* Default: `false`
|
|
1576
|
+
*
|
|
1577
|
+
* :::note
|
|
1578
|
+
* This component handles the upload process.
|
|
1579
|
+
* The consumer must process the uploaded images by listening to `imageUploaded` and
|
|
1580
|
+
* `imageRemoved` events.
|
|
1581
|
+
* :::
|
|
1582
|
+
*/
|
|
1583
|
+
this.allowInlineImages = false;
|
|
1432
1584
|
this.items = [];
|
|
1433
1585
|
this.highlightedItemIndex = 0;
|
|
1434
1586
|
/**
|
|
@@ -1443,6 +1595,7 @@ const LimeBBTextEditor = class {
|
|
|
1443
1595
|
this.registeredTriggerMap = this.triggerMap;
|
|
1444
1596
|
this.registeredCustomElements = this.customElements;
|
|
1445
1597
|
this.activeTrigger = undefined;
|
|
1598
|
+
this.activeUploads = new Set();
|
|
1446
1599
|
this.handleMouseClick = (event) => {
|
|
1447
1600
|
if (!this.textEditorPickerElement) {
|
|
1448
1601
|
return;
|
|
@@ -1500,6 +1653,39 @@ const LimeBBTextEditor = class {
|
|
|
1500
1653
|
this.handleEnterOrTabKey = (event) => {
|
|
1501
1654
|
this.handleItemSelection(event);
|
|
1502
1655
|
};
|
|
1656
|
+
this.handleImagePasted = async (event) => {
|
|
1657
|
+
event.stopPropagation();
|
|
1658
|
+
if (!this.allowInlineImages) {
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
const imageInserter = event.detail;
|
|
1662
|
+
const fileInfo = imageInserter.fileInfo;
|
|
1663
|
+
this.activeUploads.add(fileInfo.id);
|
|
1664
|
+
this.imagesUploading.emit(this.activeUploads.size > 0);
|
|
1665
|
+
const uploadedFile = await this.uploadHandler.handleImagePasted(imageInserter);
|
|
1666
|
+
const uploadedFileInfo = {
|
|
1667
|
+
fileId: uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId,
|
|
1668
|
+
fileInfoId: fileInfo.id,
|
|
1669
|
+
};
|
|
1670
|
+
if (uploadedFileInfo.fileId) {
|
|
1671
|
+
this.imageUploaded.emit(uploadedFileInfo);
|
|
1672
|
+
this.activeUploads.delete(fileInfo.id);
|
|
1673
|
+
}
|
|
1674
|
+
this.imagesUploading.emit(this.activeUploads.size > 0);
|
|
1675
|
+
};
|
|
1676
|
+
this.handleImageRemoved = (event) => {
|
|
1677
|
+
event.stopPropagation();
|
|
1678
|
+
if (!this.allowInlineImages) {
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
const imageInfo = event.detail;
|
|
1682
|
+
if (!imageInfo) {
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
this.activeUploads.delete(imageInfo.fileInfoId);
|
|
1686
|
+
this.imagesUploading.emit(this.activeUploads.size > 0);
|
|
1687
|
+
this.imageRemoved.emit(imageInfo);
|
|
1688
|
+
};
|
|
1503
1689
|
this.handleTriggerStart = (event) => {
|
|
1504
1690
|
event.stopPropagation();
|
|
1505
1691
|
this.activeTrigger = event.detail.trigger;
|
|
@@ -1602,6 +1788,7 @@ const LimeBBTextEditor = class {
|
|
|
1602
1788
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1603
1789
|
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
1604
1790
|
}
|
|
1791
|
+
this.uploadHandler = new UploadHandler(this.platform);
|
|
1605
1792
|
}
|
|
1606
1793
|
componentWillLoad() {
|
|
1607
1794
|
if (this.allowMentioning) {
|
|
@@ -1680,7 +1867,7 @@ const LimeBBTextEditor = class {
|
|
|
1680
1867
|
}
|
|
1681
1868
|
render() {
|
|
1682
1869
|
return [
|
|
1683
|
-
index.h("limel-text-editor", { key: '
|
|
1870
|
+
index.h("limel-text-editor", { key: 'ea164d7febc1e1694b31d503568d4c6f6e1573c3', ref: (el) => (this.textEditor = el), tabindex: this.disabled ? -1 : 0, value: this.value, contentType: this.contentType, customElements: this.registeredCustomElements, "aria-disabled": this.disabled, language: this.language, triggers: this.registeredTriggers, onTriggerStart: this.handleTriggerStart, onTriggerStop: this.handleTriggerStop, onTriggerChange: this.handleTriggerChange, onImagePasted: this.handleImagePasted, onImageRemoved: this.handleImageRemoved, 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 }),
|
|
1684
1871
|
this.renderPicker(),
|
|
1685
1872
|
];
|
|
1686
1873
|
}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["limebb-feed.cjs",[[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"],"direction":[1],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["limebb-chat-list.cjs",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["limebb-text-editor.cjs",[[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],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["limebb-date-range.cjs",[[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]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[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]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["limebb-component-picker.cjs",[[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"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[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]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[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]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-mention-group-counter.cjs",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["limebb-trend-indicator.cjs",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["limebb-navigation-button_2.cjs",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-group.cjs",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["limebb-feed-timeline-item.cjs",[[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]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["limebb-currency-picker.cjs",[[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]}]]],["limebb-date-picker.cjs",[[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]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-chat-item_2.cjs",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16]}],[1,"limebb-typing-indicator"]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
11
|
+
return index.bootstrapLazy([["limebb-feed.cjs",[[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"],"direction":[1],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["limebb-chat-list.cjs",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["limebb-text-editor.cjs",[[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],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["limebb-date-range.cjs",[[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]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[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]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["limebb-component-picker.cjs",[[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"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[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]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[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]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-mention-group-counter.cjs",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["limebb-trend-indicator.cjs",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["limebb-navigation-button_2.cjs",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-group.cjs",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["limebb-feed-timeline-item.cjs",[[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]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["limebb-currency-picker.cjs",[[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]}]]],["limebb-date-picker.cjs",[[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]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-chat-item_2.cjs",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16]}],[1,"limebb-typing-indicator"]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -15,6 +15,7 @@ import { ARROW_DOWN, ARROW_UP, ENTER, ESCAPE, TAB } from "../../util/keycodes";
|
|
|
15
15
|
import { createRandomString } from "../../util/random-string";
|
|
16
16
|
import { getMentionLimetypes, MentionsService } from "./mentions";
|
|
17
17
|
import { debounce } from "lodash-es";
|
|
18
|
+
import { UploadHandler } from "./uploader/building-blocks-upload-handler";
|
|
18
19
|
const DEBOUNCE_SEARCH_TIMEOUT = 300;
|
|
19
20
|
/**
|
|
20
21
|
* This component is a wrapper on the `limel-text-editor`. It adds support for platform
|
|
@@ -114,6 +115,17 @@ export class LimeBBTextEditor {
|
|
|
114
115
|
this.value = '';
|
|
115
116
|
this.triggerMap = {};
|
|
116
117
|
this.customElements = [];
|
|
118
|
+
/**
|
|
119
|
+
* Enables image pasting in the editor.
|
|
120
|
+
* Default: `false`
|
|
121
|
+
*
|
|
122
|
+
* :::note
|
|
123
|
+
* This component handles the upload process.
|
|
124
|
+
* The consumer must process the uploaded images by listening to `imageUploaded` and
|
|
125
|
+
* `imageRemoved` events.
|
|
126
|
+
* :::
|
|
127
|
+
*/
|
|
128
|
+
this.allowInlineImages = false;
|
|
117
129
|
this.items = [];
|
|
118
130
|
this.highlightedItemIndex = 0;
|
|
119
131
|
/**
|
|
@@ -128,6 +140,7 @@ export class LimeBBTextEditor {
|
|
|
128
140
|
this.registeredTriggerMap = this.triggerMap;
|
|
129
141
|
this.registeredCustomElements = this.customElements;
|
|
130
142
|
this.activeTrigger = undefined;
|
|
143
|
+
this.activeUploads = new Set();
|
|
131
144
|
this.handleMouseClick = (event) => {
|
|
132
145
|
if (!this.textEditorPickerElement) {
|
|
133
146
|
return;
|
|
@@ -185,6 +198,39 @@ export class LimeBBTextEditor {
|
|
|
185
198
|
this.handleEnterOrTabKey = (event) => {
|
|
186
199
|
this.handleItemSelection(event);
|
|
187
200
|
};
|
|
201
|
+
this.handleImagePasted = async (event) => {
|
|
202
|
+
event.stopPropagation();
|
|
203
|
+
if (!this.allowInlineImages) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const imageInserter = event.detail;
|
|
207
|
+
const fileInfo = imageInserter.fileInfo;
|
|
208
|
+
this.activeUploads.add(fileInfo.id);
|
|
209
|
+
this.imagesUploading.emit(this.activeUploads.size > 0);
|
|
210
|
+
const uploadedFile = await this.uploadHandler.handleImagePasted(imageInserter);
|
|
211
|
+
const uploadedFileInfo = {
|
|
212
|
+
fileId: uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId,
|
|
213
|
+
fileInfoId: fileInfo.id,
|
|
214
|
+
};
|
|
215
|
+
if (uploadedFileInfo.fileId) {
|
|
216
|
+
this.imageUploaded.emit(uploadedFileInfo);
|
|
217
|
+
this.activeUploads.delete(fileInfo.id);
|
|
218
|
+
}
|
|
219
|
+
this.imagesUploading.emit(this.activeUploads.size > 0);
|
|
220
|
+
};
|
|
221
|
+
this.handleImageRemoved = (event) => {
|
|
222
|
+
event.stopPropagation();
|
|
223
|
+
if (!this.allowInlineImages) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const imageInfo = event.detail;
|
|
227
|
+
if (!imageInfo) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.activeUploads.delete(imageInfo.fileInfoId);
|
|
231
|
+
this.imagesUploading.emit(this.activeUploads.size > 0);
|
|
232
|
+
this.imageRemoved.emit(imageInfo);
|
|
233
|
+
};
|
|
188
234
|
this.handleTriggerStart = (event) => {
|
|
189
235
|
event.stopPropagation();
|
|
190
236
|
this.activeTrigger = event.detail.trigger;
|
|
@@ -287,6 +333,7 @@ export class LimeBBTextEditor {
|
|
|
287
333
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
288
334
|
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
289
335
|
}
|
|
336
|
+
this.uploadHandler = new UploadHandler(this.platform);
|
|
290
337
|
}
|
|
291
338
|
componentWillLoad() {
|
|
292
339
|
if (this.allowMentioning) {
|
|
@@ -365,7 +412,7 @@ export class LimeBBTextEditor {
|
|
|
365
412
|
}
|
|
366
413
|
render() {
|
|
367
414
|
return [
|
|
368
|
-
h("limel-text-editor", { key: '
|
|
415
|
+
h("limel-text-editor", { key: 'ea164d7febc1e1694b31d503568d4c6f6e1573c3', ref: (el) => (this.textEditor = el), tabindex: this.disabled ? -1 : 0, value: this.value, contentType: this.contentType, customElements: this.registeredCustomElements, "aria-disabled": this.disabled, language: this.language, triggers: this.registeredTriggers, onTriggerStart: this.handleTriggerStart, onTriggerStop: this.handleTriggerStop, onTriggerChange: this.handleTriggerChange, onImagePasted: this.handleImagePasted, onImageRemoved: this.handleImageRemoved, 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 }),
|
|
369
416
|
this.renderPicker(),
|
|
370
417
|
];
|
|
371
418
|
}
|
|
@@ -823,6 +870,26 @@ export class LimeBBTextEditor {
|
|
|
823
870
|
"getter": false,
|
|
824
871
|
"setter": false,
|
|
825
872
|
"defaultValue": "[]"
|
|
873
|
+
},
|
|
874
|
+
"allowInlineImages": {
|
|
875
|
+
"type": "boolean",
|
|
876
|
+
"mutable": false,
|
|
877
|
+
"complexType": {
|
|
878
|
+
"original": "boolean",
|
|
879
|
+
"resolved": "boolean",
|
|
880
|
+
"references": {}
|
|
881
|
+
},
|
|
882
|
+
"required": false,
|
|
883
|
+
"optional": false,
|
|
884
|
+
"docs": {
|
|
885
|
+
"tags": [],
|
|
886
|
+
"text": "Enables image pasting in the editor.\nDefault: `false`\n\n:::note\nThis component handles the upload process.\nThe consumer must process the uploaded images by listening to `imageUploaded` and\n`imageRemoved` events.\n:::"
|
|
887
|
+
},
|
|
888
|
+
"getter": false,
|
|
889
|
+
"setter": false,
|
|
890
|
+
"attribute": "allow-inline-images",
|
|
891
|
+
"reflect": false,
|
|
892
|
+
"defaultValue": "false"
|
|
826
893
|
}
|
|
827
894
|
};
|
|
828
895
|
}
|
|
@@ -852,6 +919,63 @@ export class LimeBBTextEditor {
|
|
|
852
919
|
"resolved": "string",
|
|
853
920
|
"references": {}
|
|
854
921
|
}
|
|
922
|
+
}, {
|
|
923
|
+
"method": "imageUploaded",
|
|
924
|
+
"name": "imageUploaded",
|
|
925
|
+
"bubbles": true,
|
|
926
|
+
"cancelable": true,
|
|
927
|
+
"composed": true,
|
|
928
|
+
"docs": {
|
|
929
|
+
"tags": [],
|
|
930
|
+
"text": "Fires when an image upload completes successfully\n\n:::note\nReturns UploadedFileInfo with:\n- fileId: ID of the uploaded file (use for limeobject creation)\n- fileInfoId: ID to match this upload with any removed images\nwhen handling the imageRemoved event\n:::"
|
|
931
|
+
},
|
|
932
|
+
"complexType": {
|
|
933
|
+
"original": "UploadedFileInfo",
|
|
934
|
+
"resolved": "{ fileId: string | number | undefined; fileInfoId: string | number | undefined; }",
|
|
935
|
+
"references": {
|
|
936
|
+
"UploadedFileInfo": {
|
|
937
|
+
"location": "import",
|
|
938
|
+
"path": "./uploader/building-blocks-uploader",
|
|
939
|
+
"id": "src/components/text-editor/uploader/building-blocks-uploader.ts::UploadedFileInfo"
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}, {
|
|
944
|
+
"method": "imageRemoved",
|
|
945
|
+
"name": "imageRemoved",
|
|
946
|
+
"bubbles": true,
|
|
947
|
+
"cancelable": true,
|
|
948
|
+
"composed": true,
|
|
949
|
+
"docs": {
|
|
950
|
+
"tags": [],
|
|
951
|
+
"text": "Dispatched when an image has been removed from the editor\n\nThe ImageInfo object contains the fileInfoId which can be used to match with\npreviously uploaded images (from imageUploaded events)\n\n:::note\nThis event is forwarded from the underlying limel-text-editor component.\n:::"
|
|
952
|
+
},
|
|
953
|
+
"complexType": {
|
|
954
|
+
"original": "ImageInfo",
|
|
955
|
+
"resolved": "ImageInfo",
|
|
956
|
+
"references": {
|
|
957
|
+
"ImageInfo": {
|
|
958
|
+
"location": "import",
|
|
959
|
+
"path": "@limetech/lime-elements",
|
|
960
|
+
"id": "node_modules::ImageInfo"
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}, {
|
|
965
|
+
"method": "imagesUploading",
|
|
966
|
+
"name": "imagesUploading",
|
|
967
|
+
"bubbles": true,
|
|
968
|
+
"cancelable": true,
|
|
969
|
+
"composed": true,
|
|
970
|
+
"docs": {
|
|
971
|
+
"tags": [],
|
|
972
|
+
"text": "Will be `true` while there is an active upload in progress,\nor while there is a failed image upload."
|
|
973
|
+
},
|
|
974
|
+
"complexType": {
|
|
975
|
+
"original": "boolean",
|
|
976
|
+
"resolved": "boolean",
|
|
977
|
+
"references": {}
|
|
978
|
+
}
|
|
855
979
|
}];
|
|
856
980
|
}
|
|
857
981
|
static get elementRef() { return "host"; }
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { PlatformServiceName, } from "@limetech/lime-web-components";
|
|
2
|
+
import { FileUpload, MAX_FILE_SIZE, } from "./building-blocks-uploader";
|
|
3
|
+
const UPLOAD_COMPLETED = 100;
|
|
4
|
+
export class UploadHandler {
|
|
5
|
+
constructor(platform) {
|
|
6
|
+
this.platform = platform;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Handles image paste events in the text editor
|
|
10
|
+
*
|
|
11
|
+
* @param {ImageInserter} imageInserter - The image inserter with the file info
|
|
12
|
+
* @returns {Promise<FileWrapper | undefined>} Promise resolving to the uploaded file wrapper or undefined if upload fails
|
|
13
|
+
*/
|
|
14
|
+
async handleImagePasted(imageInserter) {
|
|
15
|
+
const fileInfo = imageInserter === null || imageInserter === void 0 ? void 0 : imageInserter.fileInfo;
|
|
16
|
+
if (!fileInfo) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!this.validateImageSize(fileInfo)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
imageInserter.insertThumbnail();
|
|
23
|
+
const uploadedFile = await this.createFileUpload(fileInfo);
|
|
24
|
+
const fileUrl = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.href;
|
|
25
|
+
const fileId = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId;
|
|
26
|
+
if (fileUrl && fileId !== undefined) {
|
|
27
|
+
imageInserter.insertImage(fileUrl);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
imageInserter.insertFailedThumbnail();
|
|
31
|
+
}
|
|
32
|
+
return uploadedFile;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validates that the image file size is within limits
|
|
36
|
+
*
|
|
37
|
+
* @param {FileInfo} fileInfo - The file info to validate
|
|
38
|
+
* @returns {boolean} True if file size is valid, false otherwise
|
|
39
|
+
*/
|
|
40
|
+
validateImageSize(fileInfo) {
|
|
41
|
+
if (!fileInfo.fileContent) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return fileInfo.fileContent.size <= MAX_FILE_SIZE;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates and uploads a file
|
|
48
|
+
*
|
|
49
|
+
* @param {FileInfo} fileInfo - The file info to upload
|
|
50
|
+
* @returns {Promise<FileWrapper | undefined>} Promise resolving to the uploaded file wrapper or undefined if upload fails
|
|
51
|
+
*/
|
|
52
|
+
async createFileUpload(fileInfo) {
|
|
53
|
+
var _a;
|
|
54
|
+
if (!fileInfo.fileContent) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const imageFile = new FileUpload(fileInfo.fileContent, this.http);
|
|
58
|
+
await imageFile.initialize();
|
|
59
|
+
const imageUpload = Object.assign(Object.assign({}, fileInfo), { progress: 0, file: imageFile, state: 'added', fileId: undefined, href: undefined, fileInfoId: fileInfo.id });
|
|
60
|
+
imageFile.onProgress = (progress) => {
|
|
61
|
+
if (imageUpload.progress === 0) {
|
|
62
|
+
imageUpload.state = 'uploading';
|
|
63
|
+
}
|
|
64
|
+
imageUpload.progress = progress;
|
|
65
|
+
if (progress === UPLOAD_COMPLETED) {
|
|
66
|
+
imageUpload.state = 'finalizing';
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const response = await imageFile.upload();
|
|
70
|
+
// FileWrapper wraps the FileStatus type, which wraps the FileInfo interface
|
|
71
|
+
// 'id' is the file id property on the FileInfo interface
|
|
72
|
+
// 'fileId' is the file id property on the FileStatus type
|
|
73
|
+
imageUpload.id = response.id;
|
|
74
|
+
imageUpload.fileId = response.id;
|
|
75
|
+
imageUpload.filename = response.filename;
|
|
76
|
+
imageUpload.extension = response.extension;
|
|
77
|
+
imageUpload.contentType = response.contentType;
|
|
78
|
+
imageUpload.size = response.size;
|
|
79
|
+
imageUpload.state = 'done';
|
|
80
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
81
|
+
imageUpload.href = (_a = response._links) === null || _a === void 0 ? void 0 : _a.contents.href;
|
|
82
|
+
return imageUpload;
|
|
83
|
+
}
|
|
84
|
+
get http() {
|
|
85
|
+
return this.platform.get(PlatformServiceName.Http);
|
|
86
|
+
}
|
|
87
|
+
}
|