lakelib 0.1.6 → 0.1.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/dist/lake.css +4 -0
- package/dist/lake.min.js +5 -5
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +4 -0
- package/lib/lake.js +17 -7
- package/lib/lake.js.map +1 -1
- package/lib/types/ui/button.d.ts +2 -1
- package/lib/types/ui/dropdown.d.ts +3 -1
- package/lib/types/ui/toolbar.d.ts +4 -1
- package/lib/types/ui/upload.d.ts +2 -2
- package/package.json +1 -1
package/lib/lake.css
CHANGED
|
@@ -249,6 +249,10 @@ button.lake-text-button span {
|
|
|
249
249
|
box-shadow: var(--popup-shadow);
|
|
250
250
|
display: none;
|
|
251
251
|
}
|
|
252
|
+
.lake-dropdown[placement="top"] .lake-dropdown-menu {
|
|
253
|
+
top: auto;
|
|
254
|
+
bottom: 30px;
|
|
255
|
+
}
|
|
252
256
|
.lake-dropdown .lake-dropdown-menu li {
|
|
253
257
|
display: flex;
|
|
254
258
|
align-items: center;
|
package/lib/lake.js
CHANGED
|
@@ -971,8 +971,8 @@ class Nodes {
|
|
|
971
971
|
}
|
|
972
972
|
// Returns the interior width of the first element, which does not include padding.
|
|
973
973
|
innerWidth() {
|
|
974
|
-
const paddingLeft = parseInt(this.computedCSS('padding-left'), 10) || 0;
|
|
975
|
-
const paddingRight = parseInt(this.computedCSS('padding-right'), 10) || 0;
|
|
974
|
+
const paddingLeft = Number.parseInt(this.computedCSS('padding-left'), 10) || 0;
|
|
975
|
+
const paddingRight = Number.parseInt(this.computedCSS('padding-right'), 10) || 0;
|
|
976
976
|
return this.width() - paddingLeft - paddingRight;
|
|
977
977
|
}
|
|
978
978
|
// Returns the height of of the first element.
|
|
@@ -4380,8 +4380,9 @@ class Dropdown {
|
|
|
4380
4380
|
this.config = config;
|
|
4381
4381
|
this.root = config.root;
|
|
4382
4382
|
this.locale = config.locale || i18nObject('en-US');
|
|
4383
|
+
const placement = config.placement || 'bottom';
|
|
4383
4384
|
this.node = query(safeTemplate `
|
|
4384
|
-
<div class="lake-dropdown lake-${config.menuType}-dropdown" name="${config.name}">
|
|
4385
|
+
<div class="lake-dropdown lake-${config.menuType}-dropdown" name="${config.name}" placement="${placement}">
|
|
4385
4386
|
<button type="button" name="${config.name}" class="lake-dropdown-title">
|
|
4386
4387
|
<div class="lake-dropdown-${config.icon ? 'icon' : 'text'}"></div>
|
|
4387
4388
|
<div class="lake-dropdown-down-icon"></div>
|
|
@@ -4481,7 +4482,11 @@ class Dropdown {
|
|
|
4481
4482
|
menuNode.show(config.menuType === 'color' ? 'flex' : 'block');
|
|
4482
4483
|
const dropdownNativeNode = dropdownNode.get(0);
|
|
4483
4484
|
const dropdownRect = dropdownNativeNode.getBoundingClientRect();
|
|
4484
|
-
|
|
4485
|
+
// A overflow width on the left side, greater than 0 indicates an overflow.
|
|
4486
|
+
const leftOverflow = menuNode.width() - (dropdownRect.x + dropdownRect.width);
|
|
4487
|
+
// A overflow width on the right side, greater than 0 indicates an overflow.
|
|
4488
|
+
const rightOverflow = dropdownRect.x + menuNode.width() - window.innerWidth;
|
|
4489
|
+
if (rightOverflow + 50 > 0 && (leftOverflow < 0 || leftOverflow < rightOverflow)) {
|
|
4485
4490
|
menuNode.css('left', 'auto');
|
|
4486
4491
|
menuNode.css('right', '0');
|
|
4487
4492
|
}
|
|
@@ -4608,7 +4613,7 @@ class Dropdown {
|
|
|
4608
4613
|
}
|
|
4609
4614
|
}
|
|
4610
4615
|
|
|
4611
|
-
var version = "0.1.
|
|
4616
|
+
var version = "0.1.7";
|
|
4612
4617
|
|
|
4613
4618
|
// Inserts a box into the specified range.
|
|
4614
4619
|
function insertBox(range, boxName, boxValue) {
|
|
@@ -6345,11 +6350,15 @@ toolbarItems.forEach(item => {
|
|
|
6345
6350
|
});
|
|
6346
6351
|
class Toolbar {
|
|
6347
6352
|
constructor(config) {
|
|
6353
|
+
this.placement = 'top';
|
|
6348
6354
|
this.allMenuMap = new Map();
|
|
6349
6355
|
this.buttonItemList = [];
|
|
6350
6356
|
this.dropdownItemList = [];
|
|
6351
|
-
this.items = config.items || defaultItems;
|
|
6352
6357
|
this.root = query(config.root);
|
|
6358
|
+
this.items = config.items || defaultItems;
|
|
6359
|
+
if (config.placement) {
|
|
6360
|
+
this.placement = config.placement;
|
|
6361
|
+
}
|
|
6353
6362
|
this.container = query('<div class="lake-toolbar" />');
|
|
6354
6363
|
this.root.addClass('lake-custom-properties');
|
|
6355
6364
|
}
|
|
@@ -6384,6 +6393,7 @@ class Toolbar {
|
|
|
6384
6393
|
menuType: item.menuType,
|
|
6385
6394
|
menuItems: item.menuItems,
|
|
6386
6395
|
tabIndex: -1,
|
|
6396
|
+
placement: this.placement === 'top' ? 'bottom' : 'top',
|
|
6387
6397
|
onSelect: value => {
|
|
6388
6398
|
editor.focus();
|
|
6389
6399
|
item.onSelect(editor, value);
|
|
@@ -8525,7 +8535,7 @@ const blockItemListForEnterKey = [
|
|
|
8525
8535
|
],
|
|
8526
8536
|
},
|
|
8527
8537
|
{
|
|
8528
|
-
re:
|
|
8538
|
+
re: /^`{3,}([a-z]*)$/i,
|
|
8529
8539
|
getParameters: (results) => {
|
|
8530
8540
|
var _a;
|
|
8531
8541
|
if (!results[1]) {
|