Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit a975be9

Browse files
sebgeelendmo-odoo
authored andcommitted
[IMP] odoo fontAwesome: Send modal options directly from JW
1 parent 8264b72 commit a975be9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/plugin-odoo/src/OdooFontAwesomeDomObjectRenderer.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ export class OdooFontAwesomeDomObjectRenderer extends FontAwesomeDomObjectRender
1717

1818
if ('tag' in fa) {
1919
const dbclickCallback = () => {
20+
const faZoomClassRegex = RegExp('fa-[0-9]x');
21+
function filterUnwantedClasses(className) {
22+
return !className.startsWith('fa') || faZoomClassRegex.test(className);
23+
}
24+
// Customize the look and behavior of the media modal when
25+
// the origin of the media modal is a FA icon double click
2026
const params = {
21-
image: node,
22-
origin: 'fontAwesomeDoubleClick',
23-
htmlClass: fa.attributes.class,
27+
noImages: true,
28+
noDocuments: true,
29+
noVideos: true,
30+
htmlClass: [...fa.attributes.class].filter(filterUnwantedClasses).join(' '),
2431
};
32+
2533
this.engine.editor.execCommand('openMedia', params);
2634
};
2735

0 commit comments

Comments
 (0)