Skip to content

Commit 0f752dc

Browse files
authored
feat: Enhance embedding media display in mobile - EXO-65717 - Meeds-io/MIPs#71 (#840)
Enhance embedding videos display in mobile
1 parent 0c3a3e1 commit 0f752dc

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

notes-webapp/src/main/webapp/vue-app/notes-editor/components/NotesEditorDashboard.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -960,23 +960,20 @@ export default {
960960
const oEmbeds = docElement.querySelectorAll('oembed');
961961
oEmbeds.forEach((oembed, index) => {
962962
oembed.innerHTML = decodeURIComponent(oembed.innerHTML);
963-
oembed.dataset.htmlSource = iframes[index]?.parentNode?.innerHTML?.toString();
963+
oembed.dataset.iframe = iframes[index]?.parentNode?.innerHTML?.toString();
964964
const width = iframes[index]?.parentNode?.offsetWidth;
965965
const height = iframes[index]?.parentNode?.offsetHeight;
966966
const aspectRatio = width / height;
967967
const minHeight = parseInt(this.oembedMinWidth) / aspectRatio;
968968
const style = `
969-
position: relative;
970-
display: flex;
971-
margin: auto;
972969
min-height: ${minHeight}px;
973970
min-width: ${this.oembedMinWidth}px;
974-
width: ${width}px;
975-
height:${height}px;
971+
width: 100%;
976972
margin-bottom: 10px;
977973
aspect-ratio: ${aspectRatio};
978974
`;
979975
oembed.setAttribute('style', style);
976+
oembed.setAttribute('class', 'd-flex position-relative ml-auto mr-auto');
980977
});
981978
return docElement?.children[1].innerHTML;
982979
},

notes-webapp/src/main/webapp/vue-app/notes/components/NotesOverview.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -860,12 +860,11 @@ export default {
860860
const contentChildren = docElement.getElementsByTagName('body')[0].children;
861861
const links = docElement.getElementsByTagName('a');
862862
const tables = docElement.getElementsByTagName('table');
863-
const oEmbeds = docElement.getElementsByTagName('oembed');
864863
docElement.querySelectorAll('pre > code').forEach((e) => codeHighlighter.highlightBlock(e));
865-
for (const oembed of oEmbeds) {
866-
oembed.innerHTML = oembed.dataset.htmlSource;
867-
delete oembed.dataset.htmlSource;
868-
}
864+
docElement.querySelectorAll('oembed').forEach((oembed) => {
865+
oembed.innerHTML = oembed.dataset.iframe;
866+
delete oembed.dataset.iframe;
867+
});
869868
for (const link of links) {
870869
let href = link.href.replace(/(^\w+:|^)\/\//, '');
871870
if (href.endsWith('/')) {
@@ -885,7 +884,6 @@ export default {
885884
table.removeAttribute('summary');
886885
}
887886
}
888-
table.style.border = `${table.getAttribute('border')}px solid`;
889887
}
890888
if (contentChildren) {
891889
for (let i = 0; i < contentChildren.length; i++) { // NOSONAR not iterable

0 commit comments

Comments
 (0)