Fossil SCM

/chat: fixed text mode toggle to not mangle messages with attachments (it apparently never worked properly with them).

stephan 2021-12-30 17:39 chat-attachment-iframe
Commit 767892228337fd4791bd70770cdb5a2bcff12004a8944c4ef2141e1ceb85074e
1 file changed +3 -1
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -701,11 +701,11 @@
701701
e = this.getMessageElemById(id);
702702
}
703703
if(!e || !id) return false;
704704
else if(e.$isToggling) return;
705705
e.$isToggling = true;
706
- const content = e.querySelector('.message-widget-content');
706
+ const content = e.querySelector('.content-target');
707707
if(!content.$elems){
708708
content.$elems = [
709709
content.firstElementChild, // parsed elem
710710
undefined // plaintext elem
711711
];
@@ -973,10 +973,12 @@
973973
/* We have file/image content, so need another element for
974974
the message text. */
975975
contentTarget = D.div();
976976
D.append(this.e.content, contentTarget);
977977
}
978
+ D.addClass(contentTarget, 'content-target'
979
+ /*target element for the 'toggle text mode' feature*/);
978980
// The m.xmsg text comes from the same server as this script and
979981
// is guaranteed by that server to be "safe" HTML - safe in the
980982
// sense that it is not possible for a malefactor to inject HTML
981983
// or javascript or CSS. The m.xmsg content might contain
982984
// hyperlinks, but otherwise it will be markup-free. See the
983985
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -701,11 +701,11 @@
701 e = this.getMessageElemById(id);
702 }
703 if(!e || !id) return false;
704 else if(e.$isToggling) return;
705 e.$isToggling = true;
706 const content = e.querySelector('.message-widget-content');
707 if(!content.$elems){
708 content.$elems = [
709 content.firstElementChild, // parsed elem
710 undefined // plaintext elem
711 ];
@@ -973,10 +973,12 @@
973 /* We have file/image content, so need another element for
974 the message text. */
975 contentTarget = D.div();
976 D.append(this.e.content, contentTarget);
977 }
 
 
978 // The m.xmsg text comes from the same server as this script and
979 // is guaranteed by that server to be "safe" HTML - safe in the
980 // sense that it is not possible for a malefactor to inject HTML
981 // or javascript or CSS. The m.xmsg content might contain
982 // hyperlinks, but otherwise it will be markup-free. See the
983
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -701,11 +701,11 @@
701 e = this.getMessageElemById(id);
702 }
703 if(!e || !id) return false;
704 else if(e.$isToggling) return;
705 e.$isToggling = true;
706 const content = e.querySelector('.content-target');
707 if(!content.$elems){
708 content.$elems = [
709 content.firstElementChild, // parsed elem
710 undefined // plaintext elem
711 ];
@@ -973,10 +973,12 @@
973 /* We have file/image content, so need another element for
974 the message text. */
975 contentTarget = D.div();
976 D.append(this.e.content, contentTarget);
977 }
978 D.addClass(contentTarget, 'content-target'
979 /*target element for the 'toggle text mode' feature*/);
980 // The m.xmsg text comes from the same server as this script and
981 // is guaranteed by that server to be "safe" HTML - safe in the
982 // sense that it is not possible for a malefactor to inject HTML
983 // or javascript or CSS. The m.xmsg content might contain
984 // hyperlinks, but otherwise it will be markup-free. See the
985

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button