diff --git a/.hgtags b/.hgtags index da8cb2539c8728d86bdd41806747a31205a0688c_LmhndGFncw==..b645ecf6dd54813dae2ab6ba6495e42486ff17c5_LmhndGFncw== 100644 --- a/.hgtags +++ b/.hgtags @@ -40,3 +40,4 @@ 26ba3f1cae7afe29f496435ac1ad714f73b0e5c5 17.0.1.4.1.2 5f6c4cb70c0e0e89f7adaa7063a4ca16841ed490 17.0.1.5.0 8374e01b68c254ee924fc5975228594ea4c2b972 17.0.1.5.0.1 +5411cb570fa548f866dc4f56262cffe5a64a7ecd 17.0.1.5.1 diff --git a/NEWS.rst b/NEWS.rst index da8cb2539c8728d86bdd41806747a31205a0688c_TkVXUy5yc3Q=..b645ecf6dd54813dae2ab6ba6495e42486ff17c5_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -2,6 +2,11 @@ Changelog ========= +17.0.1.5.1 +---------- + +Dynamic placeholder,mimetype: code cleanup and documentation fixes. + 17.0.1.5.0 ---------- diff --git a/__manifest__.py b/__manifest__.py index da8cb2539c8728d86bdd41806747a31205a0688c_X19tYW5pZmVzdF9fLnB5..b645ecf6dd54813dae2ab6ba6495e42486ff17c5_X19tYW5pZmVzdF9fLnB5 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -21,7 +21,7 @@ { "name": "Redner", "license": "AGPL-3", - "version": "17.0.1.5.0", + "version": "17.0.1.5.1", "category": "Reporting", "author": "XCG Consulting", "website": "https://orbeet.io/", diff --git a/static/src/components/dynamic_placeholder_char_field/dynamic_placeholder_char_field.js b/static/src/components/dynamic_placeholder_char_field/dynamic_placeholder_char_field.js index da8cb2539c8728d86bdd41806747a31205a0688c_c3RhdGljL3NyYy9jb21wb25lbnRzL2R5bmFtaWNfcGxhY2Vob2xkZXJfY2hhcl9maWVsZC9keW5hbWljX3BsYWNlaG9sZGVyX2NoYXJfZmllbGQuanM=..b645ecf6dd54813dae2ab6ba6495e42486ff17c5_c3RhdGljL3NyYy9jb21wb25lbnRzL2R5bmFtaWNfcGxhY2Vob2xkZXJfY2hhcl9maWVsZC9keW5hbWljX3BsYWNlaG9sZGVyX2NoYXJfZmllbGQuanM= 100644 --- a/static/src/components/dynamic_placeholder_char_field/dynamic_placeholder_char_field.js +++ b/static/src/components/dynamic_placeholder_char_field/dynamic_placeholder_char_field.js @@ -62,7 +62,4 @@ async handlePlaceholderInsert(chain, defaultValue) { if (chain) { this.input.el.focus(); - let placeholder = `{{object.${chain}${ - defaultValue?.length ? ` ||| ${defaultValue}` : "" - }}}`; @@ -68,7 +65,9 @@ + // Build placeholder based on converter type + let placeholder; switch (this.activeConverterType) { case "field": placeholder = chain; break; // Add other converter types here default: @@ -69,13 +68,13 @@ switch (this.activeConverterType) { case "field": placeholder = chain; break; // Add other converter types here default: - // Default case if no specific converter type is found - placeholder = ` {{object.${chain}${ - defaultValue?.length ? ` ||| ${defaultValue}` : "" - }}}`; + const defaultValuePart = defaultValue?.length + ? ` ||| ${defaultValue}` + : ""; + placeholder = `{{object.${chain}${defaultValuePart}}}`; break; } @@ -90,36 +89,4 @@ this.input.el.focus(); } }, - // async handlePlaceholderValidation(chain, defaultValue) { - // if (chain) { - // this.input.el.focus(); - // // Initialize dynamicPlaceholder with a default structure - // let dynamicPlaceholder = ` {{object.${chain}${ - // defaultValue?.length ? ` ||| ${defaultValue}` : "" - // }}}`; - // switch (this.converter) { - // case "field": - // // For "field" converter, use the chain directly as the value - // dynamicPlaceholder = `${chain}`; - // break; - - // default: - // // Default case if no specific converter type is found - // dynamicPlaceholder = ` {{object.${chain}${ - // defaultValue?.length ? ` ||| ${defaultValue}` : "" - // }}}`; - // break; - // } - // this.input.el.setRangeText( - // dynamicPlaceholder, - // this.selectionStart, - // this.selectionStart, - // "end" - // ); - // // trigger events to make the field dirty - // this.input.el.dispatchEvent(new InputEvent("input")); - // this.input.el.dispatchEvent(new KeyboardEvent("keydown")); - // this.input.el.focus(); - // } - // }, }); diff --git a/utils/mimetype.py b/utils/mimetype.py index da8cb2539c8728d86bdd41806747a31205a0688c_dXRpbHMvbWltZXR5cGUucHk=..b645ecf6dd54813dae2ab6ba6495e42486ff17c5_dXRpbHMvbWltZXR5cGUucHk= 100644 --- a/utils/mimetype.py +++ b/utils/mimetype.py @@ -50,7 +50,11 @@ def get_file_extension(binary_data: bytes) -> str: - """Determine the file extension from binary content.""" + """Determine the file extension from binary content. + + :param binary_data: Binary content of the file + :return: File extension string (default: .odt) + """ file_type = guess_mimetype(binary_data) # Mapping MIME types to extensions @@ -62,7 +66,4 @@ "application/msword": ".doc", "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx", # noqa: E501 } - # TODO the comment on line 64 is incorrect, it defaults to .odt - return mime_to_ext.get( - file_type, ".odt" - ) # Default to empty string if MIME type not found + return mime_to_ext.get(file_type, ".odt") # Default to .odt if MIME type not found