Fossil SCM
/chat: fixed text mode toggle to not mangle messages with attachments (it apparently never worked properly with them).
Commit
767892228337fd4791bd70770cdb5a2bcff12004a8944c4ef2141e1ceb85074e
Parent
d9e3ed5e209cccf…
1 file changed
+3
-1
+3
-1
| --- src/fossil.page.chat.js | ||
| +++ src/fossil.page.chat.js | ||
| @@ -701,11 +701,11 @@ | ||
| 701 | 701 | e = this.getMessageElemById(id); |
| 702 | 702 | } |
| 703 | 703 | if(!e || !id) return false; |
| 704 | 704 | else if(e.$isToggling) return; |
| 705 | 705 | e.$isToggling = true; |
| 706 | - const content = e.querySelector('.message-widget-content'); | |
| 706 | + const content = e.querySelector('.content-target'); | |
| 707 | 707 | if(!content.$elems){ |
| 708 | 708 | content.$elems = [ |
| 709 | 709 | content.firstElementChild, // parsed elem |
| 710 | 710 | undefined // plaintext elem |
| 711 | 711 | ]; |
| @@ -973,10 +973,12 @@ | ||
| 973 | 973 | /* We have file/image content, so need another element for |
| 974 | 974 | the message text. */ |
| 975 | 975 | contentTarget = D.div(); |
| 976 | 976 | D.append(this.e.content, contentTarget); |
| 977 | 977 | } |
| 978 | + D.addClass(contentTarget, 'content-target' | |
| 979 | + /*target element for the 'toggle text mode' feature*/); | |
| 978 | 980 | // The m.xmsg text comes from the same server as this script and |
| 979 | 981 | // is guaranteed by that server to be "safe" HTML - safe in the |
| 980 | 982 | // sense that it is not possible for a malefactor to inject HTML |
| 981 | 983 | // or javascript or CSS. The m.xmsg content might contain |
| 982 | 984 | // hyperlinks, but otherwise it will be markup-free. See the |
| 983 | 985 |
| --- 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 |