Skip to content

Commit

Permalink
fix(minimal-mode): add file button should open system dialog (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
nd0ut authored Oct 20, 2023
1 parent c8519e9 commit 366d524
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
8 changes: 8 additions & 0 deletions abstract/Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ export class Block extends BaseComponent {
let o = Object.create(null);
/** @private */
this.__cfgProxy = new Proxy(o, {
set: (obj, key, value) => {
if (typeof key !== 'string') {
return false;
}
const sharedKey = sharedConfigKey(/** @type {keyof import('../types').ConfigType} */ (key));
this.$[sharedKey] = value;
return true;
},
/**
* @param {never} obj
* @param {keyof import('../types').ConfigType} key
Expand Down
14 changes: 13 additions & 1 deletion blocks/Config/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,21 @@ export class Config extends Block {

initCallback() {
super.initCallback();
const anyThis = /** @type {typeof this & any} */ (this);

for (const key of plainConfigKeys) {
this.sub(
sharedConfigKey(key),
(value) => {
if (value !== initialConfig[key]) {
anyThis[key] = value;
}
},
false
);
}

for (const key of allConfigKeys) {
const anyThis = /** @type {typeof this & any} */ (this);
let localPropName = '__' + key;
anyThis[localPropName] = anyThis[key];

Expand Down
14 changes: 3 additions & 11 deletions blocks/test/raw-minimal.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@

<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
.config {
--ctx-name: 'my-uploader';
--cfg-pubkey: 'demopublickey';
--cfg-multiple: 0;
--cfg-multiple-min: 0;
--cfg-multiple-max: 3;
--darkmode: 0;
}
</style>
<script
async=""
src="https://cdn.skypack.dev/-/[email protected]/dist=es2020,mode=raw,min/dist/es-module-shims.js"
Expand All @@ -32,4 +22,6 @@
</script>
</head>

<lr-file-uploader-minimal class="config" css-src="./solutions/file-uploader/minimal/index.css"></lr-file-uploader-minimal>
<lr-file-uploader-minimal ctx-name="my-uploader" css-src="./solutions/file-uploader/minimal/index.css"></lr-file-uploader-minimal>
<lr-config ctx-name="my-uploader" pubkey="demopublickey" crop-preset="1:1" cloudImageEditorTabs="crop" cloud-image-editor-tabs="crop"></lr-config>
<lr-data-output ctx-name="my-uploader" use-console></lr-data-output>

0 comments on commit 366d524

Please sign in to comment.