Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(minimal-mode): add file button didn't open the system dialog #544

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading