@limetech/lime-elements 37.43.0 → 37.44.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 +18 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js +1 -1
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +94 -56
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +2 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{translations-a67fc927.js → translations-988a3f51.js} +55 -1
- package/dist/cjs/translations-988a3f51.js.map +1 -0
- package/dist/collection/components/input-field/input-field.css +3 -3
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js +19 -4
- package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-items.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +97 -51
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.js +25 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/collection/translations/da.js +9 -0
- package/dist/collection/translations/da.js.map +1 -1
- package/dist/collection/translations/en.js +9 -0
- package/dist/collection/translations/en.js.map +1 -1
- package/dist/collection/translations/fi.js +9 -0
- package/dist/collection/translations/fi.js.map +1 -1
- package/dist/collection/translations/nl.js +9 -0
- package/dist/collection/translations/nl.js.map +1 -1
- package/dist/collection/translations/no.js +9 -0
- package/dist/collection/translations/no.js.map +1 -1
- package/dist/collection/translations/sv.js +9 -0
- package/dist/collection/translations/sv.js.map +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-breadcrumbs_7.entry.js +1 -1
- package/dist/esm/limel-breadcrumbs_7.entry.js.map +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +1 -1
- package/dist/esm/limel-file-viewer.entry.js +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +94 -56
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/limel-text-editor.entry.js +2 -1
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{translations-cab6bc1e.js → translations-e73d7840.js} +55 -1
- package/dist/esm/translations-e73d7840.js.map +1 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/{p-61f3a6ab.entry.js → p-16f7ddd0.entry.js} +2 -2
- package/dist/lime-elements/{p-e1641410.entry.js → p-25d2faff.entry.js} +2 -2
- package/dist/lime-elements/{p-50d01bf8.entry.js → p-2f453044.entry.js} +2 -2
- package/dist/lime-elements/p-2f453044.entry.js.map +1 -0
- package/dist/lime-elements/p-50a34fa3.entry.js +2 -0
- package/dist/lime-elements/p-50a34fa3.entry.js.map +1 -0
- package/dist/lime-elements/{p-cab2fc85.entry.js → p-7681dae8.entry.js} +2 -2
- package/dist/lime-elements/{p-24c69726.entry.js → p-ab13cb4a.entry.js} +2 -2
- package/dist/lime-elements/{p-6886036e.entry.js → p-c5f96fcd.entry.js} +2 -2
- package/dist/lime-elements/p-c5f96fcd.entry.js.map +1 -0
- package/dist/lime-elements/{p-1b10fc91.entry.js → p-c8ce7cd4.entry.js} +2 -2
- package/dist/lime-elements/p-cd6b9ff0.js +2 -0
- package/dist/lime-elements/p-cd6b9ff0.js.map +1 -0
- package/dist/lime-elements/{p-0b52bddf.entry.js → p-dfc28411.entry.js} +2 -2
- package/dist/types/components/text-editor/prosemirror-adapter/menu/menu-items.d.ts +13 -2
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +15 -3
- package/dist/types/components/text-editor/text-editor.d.ts +5 -0
- package/dist/types/components.d.ts +16 -0
- package/dist/types/translations/da.d.ts +9 -0
- package/dist/types/translations/en.d.ts +9 -0
- package/dist/types/translations/fi.d.ts +9 -0
- package/dist/types/translations/nl.d.ts +9 -0
- package/dist/types/translations/no.d.ts +9 -0
- package/dist/types/translations/sv.d.ts +9 -0
- package/package.json +1 -1
- package/dist/cjs/translations-a67fc927.js.map +0 -1
- package/dist/esm/translations-cab6bc1e.js.map +0 -1
- package/dist/lime-elements/p-00caa45f.js +0 -2
- package/dist/lime-elements/p-00caa45f.js.map +0 -1
- package/dist/lime-elements/p-11565c0e.entry.js +0 -2
- package/dist/lime-elements/p-11565c0e.entry.js.map +0 -1
- package/dist/lime-elements/p-50d01bf8.entry.js.map +0 -1
- package/dist/lime-elements/p-6886036e.entry.js.map +0 -1
- /package/dist/lime-elements/{p-61f3a6ab.entry.js.map → p-16f7ddd0.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-e1641410.entry.js.map → p-25d2faff.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-cab2fc85.entry.js.map → p-7681dae8.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-24c69726.entry.js.map → p-ab13cb4a.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-1b10fc91.entry.js.map → p-c8ce7cd4.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-0b52bddf.entry.js.map → p-dfc28411.entry.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
|
-
const translations = require('./translations-
|
|
6
|
+
const translations = require('./translations-988a3f51.js');
|
|
7
7
|
|
|
8
8
|
const calloutIcons = {
|
|
9
9
|
note: 'info',
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
6
|
const getIconProps = require('./get-icon-props-50be7440.js');
|
|
7
7
|
const makeEnterClickable = require('./make-enter-clickable-c116ac4f.js');
|
|
8
|
-
const translations = require('./translations-
|
|
8
|
+
const translations = require('./translations-988a3f51.js');
|
|
9
9
|
const keycodes = require('./keycodes-3949f425.js');
|
|
10
10
|
const isEmpty = require('./isEmpty-0f6ef58e.js');
|
|
11
11
|
const linkHelper = require('./link-helper-b7e6c8df.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
|
-
const translations = require('./translations-
|
|
6
|
+
const translations = require('./translations-988a3f51.js');
|
|
7
7
|
|
|
8
8
|
function detectExtension(fileName, url) {
|
|
9
9
|
const pathLike = fileName || url;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
|
-
const translations = require('./translations-
|
|
6
|
+
const translations = require('./translations-988a3f51.js');
|
|
7
7
|
const fileMetadata = require('./file-metadata-f259bba5.js');
|
|
8
8
|
require('./get-icon-props-50be7440.js');
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
|
-
const translations = require('./translations-
|
|
6
|
+
const translations = require('./translations-988a3f51.js');
|
|
7
7
|
const _commonjsHelpers = require('./_commonjsHelpers-0c557e26.js');
|
|
8
8
|
require('./sv-1f9a8edc.js');
|
|
9
9
|
const moment = require('./moment-6b5ef9b3.js');
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
|
-
const markdownParser = require('./markdown-parser-1686b0d7.js');
|
|
7
|
-
const isItem = require('./isItem-3f8ad629.js');
|
|
8
6
|
const _Uint8Array = require('./_Uint8Array-f61bb71a.js');
|
|
9
7
|
const _assignValue = require('./_assignValue-7c18d8d6.js');
|
|
10
8
|
const _getAllKeysIn = require('./_getAllKeysIn-49d19250.js');
|
|
11
9
|
const isObject$1 = require('./isObject-e28b7997.js');
|
|
12
10
|
const isArray = require('./isArray-d188a04f.js');
|
|
13
11
|
const isObjectLike = require('./isObjectLike-3e3f0cba.js');
|
|
14
|
-
require('./
|
|
12
|
+
const markdownParser = require('./markdown-parser-1686b0d7.js');
|
|
13
|
+
const translations = require('./translations-988a3f51.js');
|
|
14
|
+
const isItem = require('./isItem-3f8ad629.js');
|
|
15
15
|
require('./eq-9a943b00.js');
|
|
16
16
|
require('./_getNative-60328036.js');
|
|
17
17
|
require('./isArrayLike-ac53bdac.js');
|
|
18
18
|
require('./_defineProperty-8f56146d.js');
|
|
19
|
+
require('./_commonjsHelpers-0c557e26.js');
|
|
19
20
|
|
|
20
21
|
/** Built-in value references. */
|
|
21
22
|
var objectCreate = Object.create;
|
|
@@ -16715,7 +16716,7 @@ const textEditorMenuItems = [
|
|
|
16715
16716
|
{ separator: true },
|
|
16716
16717
|
{
|
|
16717
16718
|
value: EditorMenuTypes.HeaderLevel1,
|
|
16718
|
-
text: 'Header
|
|
16719
|
+
text: 'Header 1',
|
|
16719
16720
|
commandText: `${mod} ${shift} 1`,
|
|
16720
16721
|
icon: '-lime-text-h-heading-1',
|
|
16721
16722
|
iconOnly: true,
|
|
@@ -16723,7 +16724,7 @@ const textEditorMenuItems = [
|
|
|
16723
16724
|
},
|
|
16724
16725
|
{
|
|
16725
16726
|
value: EditorMenuTypes.HeaderLevel2,
|
|
16726
|
-
text: 'Header
|
|
16727
|
+
text: 'Header 2',
|
|
16727
16728
|
commandText: `${mod} ${shift} 2`,
|
|
16728
16729
|
icon: '-lime-text-h-heading-2',
|
|
16729
16730
|
iconOnly: true,
|
|
@@ -16731,7 +16732,7 @@ const textEditorMenuItems = [
|
|
|
16731
16732
|
},
|
|
16732
16733
|
{
|
|
16733
16734
|
value: EditorMenuTypes.HeaderLevel3,
|
|
16734
|
-
text: 'Header
|
|
16735
|
+
text: 'Header 3',
|
|
16735
16736
|
commandText: `${mod} ${shift} 3`,
|
|
16736
16737
|
icon: '-lime-text-h-heading-3',
|
|
16737
16738
|
iconOnly: true,
|
|
@@ -16760,6 +16761,20 @@ const textEditorMenuItems = [
|
|
|
16760
16761
|
selected: false,
|
|
16761
16762
|
},
|
|
16762
16763
|
];
|
|
16764
|
+
const getTextEditorMenuItems = () => cloneDeep(textEditorMenuItems);
|
|
16765
|
+
const menuTranslationIDs = {
|
|
16766
|
+
strong: 'editor-menu.bold',
|
|
16767
|
+
em: 'editor-menu.italic',
|
|
16768
|
+
headerlevel1: 'editor-menu.h1',
|
|
16769
|
+
headerlevel2: 'editor-menu.h2',
|
|
16770
|
+
headerlevel3: 'editor-menu.h3',
|
|
16771
|
+
/* eslint-disable camelcase */
|
|
16772
|
+
bullet_list: 'editor-menu.bulleted-list',
|
|
16773
|
+
ordered_list: 'editor-menu.numbered-list',
|
|
16774
|
+
/* eslint-enable camelcase */
|
|
16775
|
+
blockquote: 'editor-menu.blockquote',
|
|
16776
|
+
link: 'editor-menu.link',
|
|
16777
|
+
};
|
|
16763
16778
|
|
|
16764
16779
|
/* eslint-disable no-bitwise */
|
|
16765
16780
|
|
|
@@ -25427,53 +25442,30 @@ const ProsemirrorAdapter = class {
|
|
|
25427
25442
|
constructor(hostRef) {
|
|
25428
25443
|
index.registerInstance(this, hostRef);
|
|
25429
25444
|
this.change = index.createEvent(this, "change", 7);
|
|
25430
|
-
this.
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25440
|
-
if (this.value) {
|
|
25441
|
-
initialContentElement.innerHTML =
|
|
25442
|
-
await this.contentConverter.parseAsHTML(this.value, schema$1);
|
|
25443
|
-
}
|
|
25444
|
-
const initialDoc = DOMParser.fromSchema(mySchema).parse(initialContentElement);
|
|
25445
|
-
this.menuCommandFactory = new MenuCommandFactory(mySchema);
|
|
25446
|
-
this.editorKeyMap = this.menuCommandFactory.buildKeymap();
|
|
25447
|
-
const keymapPlugin = keymap(this.editorKeyMap);
|
|
25448
|
-
this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {
|
|
25449
|
-
state: EditorState.create({
|
|
25450
|
-
doc: initialDoc,
|
|
25451
|
-
plugins: [
|
|
25452
|
-
...exampleSetup({
|
|
25453
|
-
schema: mySchema,
|
|
25454
|
-
menuBar: false,
|
|
25455
|
-
}),
|
|
25456
|
-
keymapPlugin,
|
|
25457
|
-
this.createMenuStateTrackingPlugin(this.actionBarItems),
|
|
25458
|
-
],
|
|
25459
|
-
}),
|
|
25460
|
-
dispatchTransaction: (transaction) => {
|
|
25461
|
-
const newState = this.view.state.apply(transaction);
|
|
25462
|
-
this.view.updateState(newState);
|
|
25463
|
-
this.change.emit(this.contentConverter.serialize(this.view, schema$1));
|
|
25464
|
-
},
|
|
25465
|
-
});
|
|
25466
|
-
this.menuCommandFactory = new MenuCommandFactory(mySchema);
|
|
25467
|
-
if (this.value) {
|
|
25468
|
-
this.updateView(this.value);
|
|
25445
|
+
this.getActionBarItems = () => {
|
|
25446
|
+
this.actionBarItems = getTextEditorMenuItems().map(this.getTranslatedItem);
|
|
25447
|
+
};
|
|
25448
|
+
this.getTranslatedItem = (item) => {
|
|
25449
|
+
const newItem = cloneDeep(item);
|
|
25450
|
+
if (isItem.isItem(item)) {
|
|
25451
|
+
const translationId = menuTranslationIDs[item.value];
|
|
25452
|
+
if (translationId) {
|
|
25453
|
+
newItem.text = translations.translate.get(translationId, this.language);
|
|
25454
|
+
}
|
|
25469
25455
|
}
|
|
25456
|
+
return newItem;
|
|
25457
|
+
};
|
|
25458
|
+
this.handleTransaction = (transaction) => {
|
|
25459
|
+
const newState = this.view.state.apply(transaction);
|
|
25460
|
+
this.view.updateState(newState);
|
|
25461
|
+
this.change.emit(this.contentConverter.serialize(this.view, this.schema));
|
|
25470
25462
|
};
|
|
25471
25463
|
this.handleActionBarItem = (event) => {
|
|
25472
25464
|
event.preventDefault();
|
|
25473
25465
|
const { value } = event.detail;
|
|
25474
25466
|
try {
|
|
25475
25467
|
const command = this.menuCommandFactory.getCommand(value);
|
|
25476
|
-
this.
|
|
25468
|
+
this.dispatchMenuCommand(command);
|
|
25477
25469
|
}
|
|
25478
25470
|
catch (error) {
|
|
25479
25471
|
throw new Error(`Error executing command: ${error}`);
|
|
@@ -25507,29 +25499,28 @@ const ProsemirrorAdapter = class {
|
|
|
25507
25499
|
};
|
|
25508
25500
|
this.contentType = 'markdown';
|
|
25509
25501
|
this.value = undefined;
|
|
25502
|
+
this.language = undefined;
|
|
25510
25503
|
this.view = undefined;
|
|
25511
25504
|
this.actionBarItems = [];
|
|
25512
25505
|
}
|
|
25513
25506
|
watchValue(newValue) {
|
|
25514
25507
|
if (!this.view ||
|
|
25515
|
-
newValue === this.contentConverter.serialize(this.view, schema
|
|
25508
|
+
newValue === this.contentConverter.serialize(this.view, this.schema)) {
|
|
25516
25509
|
return;
|
|
25517
25510
|
}
|
|
25518
25511
|
this.updateView(newValue);
|
|
25519
25512
|
}
|
|
25520
25513
|
componentWillLoad() {
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
}
|
|
25524
|
-
else if (this.contentType === 'html') {
|
|
25525
|
-
this.contentConverter = new HTMLConverter();
|
|
25526
|
-
}
|
|
25514
|
+
this.getActionBarItems();
|
|
25515
|
+
this.setupContentConverter();
|
|
25527
25516
|
}
|
|
25528
25517
|
componentDidLoad() {
|
|
25529
25518
|
// Stencil complains loudly about triggering rerenders in
|
|
25530
25519
|
// componentDidLoad, but we have to, so we're using setTimeout to
|
|
25531
25520
|
// suppress the warning. /Ads
|
|
25532
|
-
setTimeout(
|
|
25521
|
+
setTimeout(() => {
|
|
25522
|
+
this.initializeTextEditor();
|
|
25523
|
+
}, 0);
|
|
25533
25524
|
}
|
|
25534
25525
|
render() {
|
|
25535
25526
|
return [
|
|
@@ -25537,8 +25528,55 @@ const ProsemirrorAdapter = class {
|
|
|
25537
25528
|
index.h("limel-action-bar", { accessibleLabel: "Toolbar", actions: this.actionBarItems, onItemSelected: this.handleActionBarItem }),
|
|
25538
25529
|
];
|
|
25539
25530
|
}
|
|
25531
|
+
setupContentConverter() {
|
|
25532
|
+
/* eslint-disable multiline-ternary */
|
|
25533
|
+
this.contentConverter =
|
|
25534
|
+
this.contentType === 'markdown'
|
|
25535
|
+
? new markdownConverter()
|
|
25536
|
+
: new HTMLConverter();
|
|
25537
|
+
/* eslint-enable multiline-ternary */
|
|
25538
|
+
}
|
|
25539
|
+
async initializeTextEditor() {
|
|
25540
|
+
this.schema = this.initializeSchema();
|
|
25541
|
+
const initialDoc = await this.parseInitialContent();
|
|
25542
|
+
this.menuCommandFactory = new MenuCommandFactory(this.schema);
|
|
25543
|
+
this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {
|
|
25544
|
+
state: this.createEditorState(initialDoc),
|
|
25545
|
+
dispatchTransaction: this.handleTransaction,
|
|
25546
|
+
});
|
|
25547
|
+
if (this.value) {
|
|
25548
|
+
this.updateView(this.value);
|
|
25549
|
+
}
|
|
25550
|
+
}
|
|
25551
|
+
initializeSchema() {
|
|
25552
|
+
return new Schema({
|
|
25553
|
+
nodes: addListNodes(schema$1.spec.nodes, 'paragraph block*', 'block'),
|
|
25554
|
+
marks: schema$1.spec.marks,
|
|
25555
|
+
});
|
|
25556
|
+
}
|
|
25557
|
+
async parseInitialContent() {
|
|
25558
|
+
const initialContentElement = document.createElement('div');
|
|
25559
|
+
if (this.value) {
|
|
25560
|
+
initialContentElement.innerHTML =
|
|
25561
|
+
await this.contentConverter.parseAsHTML(this.value, this.schema);
|
|
25562
|
+
}
|
|
25563
|
+
else {
|
|
25564
|
+
initialContentElement.innerHTML = '<p></p>';
|
|
25565
|
+
}
|
|
25566
|
+
return DOMParser.fromSchema(this.schema).parse(initialContentElement);
|
|
25567
|
+
}
|
|
25568
|
+
createEditorState(initialDoc) {
|
|
25569
|
+
return EditorState.create({
|
|
25570
|
+
doc: initialDoc,
|
|
25571
|
+
plugins: [
|
|
25572
|
+
...exampleSetup({ schema: this.schema, menuBar: false }),
|
|
25573
|
+
keymap(this.menuCommandFactory.buildKeymap()),
|
|
25574
|
+
this.createMenuStateTrackingPlugin(this.actionBarItems),
|
|
25575
|
+
],
|
|
25576
|
+
});
|
|
25577
|
+
}
|
|
25540
25578
|
async updateView(content) {
|
|
25541
|
-
const html = await this.contentConverter.parseAsHTML(content, schema
|
|
25579
|
+
const html = await this.contentConverter.parseAsHTML(content, this.schema);
|
|
25542
25580
|
const prosemirrorDOMparser = DOMParser.fromSchema(this.view.state.schema);
|
|
25543
25581
|
const domParser = new window.DOMParser();
|
|
25544
25582
|
const doc = domParser.parseFromString(html, 'text/html');
|
|
@@ -25547,7 +25585,7 @@ const ProsemirrorAdapter = class {
|
|
|
25547
25585
|
tr.replaceWith(0, tr.doc.content.size, prosemirrorDoc.content);
|
|
25548
25586
|
this.view.dispatch(tr);
|
|
25549
25587
|
}
|
|
25550
|
-
|
|
25588
|
+
dispatchMenuCommand(command) {
|
|
25551
25589
|
const { state } = this.view;
|
|
25552
25590
|
const selection = state.selection;
|
|
25553
25591
|
let transaction = state.tr;
|