Fossil

Check-in [60ed1ff951]
Login

Check-in [60ed1ff951]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Updated changelog for chat preview. Hyperlinks in preview mode now have target=_blank. Removed extraneous FORM element around chat input area, as it caused only grief with regards to Enter key handling (always activating the first button in the list, which is now the preview button).
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 60ed1ff9511306a902128adf6b8b789d4b2b265d5e7f9fe2002b651dbe1a0a44
User & Date: stephan 2021-09-21 15:02:18.831
Context
2021-09-21
16:19
Initial implementation of "span data-foo" wrappers around @name and #tag references. Seems functional on a test-markdown-render basis, but the definitions of what counts as a reference and what to do with them still remains to be handled. ... (check-in: 31a607d33c user: wyoung tags: markdown-tagrefs)
16:10
Reimplemented chat message operations popup as an inlined DOM element to enable a confirmation option on the global delete button, per request from drh (and it's also more platform-portable). ... (check-in: fb9026e264 user: stephan tags: trunk)
15:02
Updated changelog for chat preview. Hyperlinks in preview mode now have target=_blank. Removed extraneous FORM element around chat input area, as it caused only grief with regards to Enter key handling (always activating the first button in the list, which is now the preview button). ... (check-in: 60ed1ff951 user: stephan tags: trunk)
14:34
/chat restored accidentally-removed configurable notification sounds. More layout tweaks on chat buttons. ... (check-in: cf81ddf97a user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/chat.c.
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
    return;
  }
  zAlert = mprintf("%s/builtin/%s", g.zBaseURL,
                db_get("chat-alert-sound","alerts/plunk.wav"));
  zProjectName = db_get("project-name","Unnamed project");
  style_set_current_feature("chat");
  style_header("Chat");
  @ <form accept-encoding="utf-8" id="chat-form" autocomplete="off">
  @ <div id='chat-input-area'>
  @   <div id='chat-input-line' class='single-line'>
  @     <input type="text" name="msg" id="chat-input-single" \
  @      placeholder="Type markdown-formatted message for %h(zProjectName)." \
  @      autocomplete="off">
  @     <textarea rows="8" id="chat-input-multi" \
  @      placeholder="Type markdown-formatted message for %h(zProjectName). Ctrl-Enter sends it." \







<







150
151
152
153
154
155
156

157
158
159
160
161
162
163
    return;
  }
  zAlert = mprintf("%s/builtin/%s", g.zBaseURL,
                db_get("chat-alert-sound","alerts/plunk.wav"));
  zProjectName = db_get("project-name","Unnamed project");
  style_set_current_feature("chat");
  style_header("Chat");

  @ <div id='chat-input-area'>
  @   <div id='chat-input-line' class='single-line'>
  @     <input type="text" name="msg" id="chat-input-single" \
  @      placeholder="Type markdown-formatted message for %h(zProjectName)." \
  @      autocomplete="off">
  @     <textarea rows="8" id="chat-input-multi" \
  @      placeholder="Type markdown-formatted message for %h(zProjectName). Ctrl-Enter sends it." \
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
  @        your environment.
  @       </div>
  @       <input type="file" name="file" id="chat-input-file">
  @     </div>
  @     <div id="chat-drop-details"></div>
  @   </div>
  @ </div>
  @ </form>
  @ <div id='chat-preview' class='hidden'>
  @  <header>Preview: (<a href='%R/md_rules' target='_blank'>markdown reference</a>)</header>
  @  <div id='chat-preview-content' class='message-widget-content'></div>
  @  <div id='chat-preview-buttons'><button id='chat-preview-close'>Close Preview</button></div>
  @ </div>
  @ <div id='chat-config' class='hidden'>
  @ <div id='chat-config-options'></div>







<







179
180
181
182
183
184
185

186
187
188
189
190
191
192
  @        your environment.
  @       </div>
  @       <input type="file" name="file" id="chat-input-file">
  @     </div>
  @     <div id="chat-drop-details"></div>
  @   </div>
  @ </div>

  @ <div id='chat-preview' class='hidden'>
  @  <header>Preview: (<a href='%R/md_rules' target='_blank'>markdown reference</a>)</header>
  @  <div id='chat-preview-content' class='message-widget-content'></div>
  @  <div id='chat-preview-buttons'><button id='chat-preview-close'>Close Preview</button></div>
  @ </div>
  @ <div id='chat-config' class='hidden'>
  @ <div id='chat-config-options'></div>
Changes to src/chat.js.
31
32
33
34
35
36
37


38
39
40
41
42
43
44
    const r1 = e.getBoundingClientRect(),
          r2 = v.getBoundingClientRect();
    if(r1.top<=r2.bottom && r1.top>=r2.top) return true;
    else if(r1.bottom<=r2.bottom && r1.bottom>=r2.top) return true;
    return false;
  };



  (function(){
    let dbg = document.querySelector('#debugMsg');
    if(dbg){
      /* This can inadvertently influence our flexbox layouts, so move
         it out of the way. */
      D.append(document.body,dbg);
    }







>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    const r1 = e.getBoundingClientRect(),
          r2 = v.getBoundingClientRect();
    if(r1.top<=r2.bottom && r1.top>=r2.top) return true;
    else if(r1.bottom<=r2.bottom && r1.bottom>=r2.top) return true;
    return false;
  };

  const addAnchorTargetBlank = (e)=>D.attr(e, 'target','_blank');

  (function(){
    let dbg = document.querySelector('#debugMsg');
    if(dbg){
      /* This can inadvertently influence our flexbox layouts, so move
         it out of the way. */
      D.append(document.body,dbg);
    }
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
        messageInjectPoint: E1('#message-inject-point'),
        pageTitle: E1('head title'),
        loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
        inputWrapper: E1("#chat-input-area"),
        inputLine: E1('#chat-input-line'),
        fileSelectWrapper: E1('#chat-input-file-area'),
        messagesWrapper: E1('#chat-messages-wrapper'),
        inputForm: E1('#chat-form'),
        btnSubmit: E1('#chat-message-submit'),
        inputSingle: E1('#chat-input-single'),
        inputMulti: E1('#chat-input-multi'),
        inputCurrent: undefined/*one of inputSingle or inputMulti*/,
        inputFile: E1('#chat-input-file'),
        contentDiv: E1('div.content'),
        configArea: E1('#chat-config'),







<







104
105
106
107
108
109
110

111
112
113
114
115
116
117
        messageInjectPoint: E1('#message-inject-point'),
        pageTitle: E1('head title'),
        loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */,
        inputWrapper: E1("#chat-input-area"),
        inputLine: E1('#chat-input-line'),
        fileSelectWrapper: E1('#chat-input-file-area'),
        messagesWrapper: E1('#chat-messages-wrapper'),

        btnSubmit: E1('#chat-message-submit'),
        inputSingle: E1('#chat-input-single'),
        inputMulti: E1('#chat-input-multi'),
        inputCurrent: undefined/*one of inputSingle or inputMulti*/,
        inputFile: E1('#chat-input-file'),
        contentDiv: E1('div.content'),
        configArea: E1('#chat-config'),
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
      return [
        d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/),
        '-',pad2(d.getDate()),
        ' ',pad2(d.getHours()),':',pad2(d.getMinutes()),
        ':',pad2(d.getSeconds())
      ].join('');
    };
    const addAnchorTargetBlank = (e)=>D.attr(e, 'target','_blank');
    cf.prototype = {
      scrollIntoView: function(){
        this.e.content.scrollIntoView();
      },
      setMessage: function(m){
        const ds = this.e.body.dataset;
        ds.timestamp = m.mtime;







<







667
668
669
670
671
672
673

674
675
676
677
678
679
680
      return [
        d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/),
        '-',pad2(d.getDate()),
        ' ',pad2(d.getHours()),':',pad2(d.getMinutes()),
        ':',pad2(d.getSeconds())
      ].join('');
    };

    cf.prototype = {
      scrollIntoView: function(){
        this.e.content.scrollIntoView();
      },
      setMessage: function(m){
        const ds = this.e.body.dataset;
        ds.timestamp = m.mtime;
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
     empty, this is a no-op.
  */
  Chat.submitMessage = function f(){
    if(!f.spaces){
      f.spaces = /\s+$/;
    }
    this.revealPreview(false);
    const fd = new FormData(this.e.inputForm)
    /* ^^^^ we don't really want/need the FORM element, but when
       FormData() is default-constructed here then the server
       segfaults, and i have no clue why! */;
    var msg = this.inputValue().trim();
    if(msg && (msg.indexOf('\n')>0 || f.spaces.test(msg))){
      /* Cosmetic: trim whitespace from the ends of lines to try to
         keep copy/paste from terminals, especially wide ones, from
         forcing a horizontal scrollbar on all clients. */
      const xmsg = msg.split('\n');
      xmsg.forEach(function(line,ndx){







|
<
<
<







954
955
956
957
958
959
960
961



962
963
964
965
966
967
968
     empty, this is a no-op.
  */
  Chat.submitMessage = function f(){
    if(!f.spaces){
      f.spaces = /\s+$/;
    }
    this.revealPreview(false);
    const fd = new FormData();



    var msg = this.inputValue().trim();
    if(msg && (msg.indexOf('\n')>0 || f.spaces.test(msg))){
      /* Cosmetic: trim whitespace from the ends of lines to try to
         keep copy/paste from terminals, especially wide ones, from
         forcing a horizontal scrollbar on all clients. */
      const xmsg = msg.split('\n');
      xmsg.forEach(function(line,ndx){
1147
1148
1149
1150
1151
1152
1153


1154
1155
1156
1157
1158
1159
1160
    //settingsButton.click()/*for for development*/;
  })()/*#chat-settings-button setup*/;

  (function(){/*set up message preview*/
    const btnPreview = Chat.e.btnPreview;
    Chat.setPreviewText = function(t){
      this.revealPreview(true).e.previewContent.innerHTML = t;


    };
    /**
       Reveals preview area if showIt is true, else hides it.
       This also shows/hides other elements, "as appropriate."
    */
    Chat.revealPreview = function(showIt){
      if(showIt){







>
>







1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
    //settingsButton.click()/*for for development*/;
  })()/*#chat-settings-button setup*/;

  (function(){/*set up message preview*/
    const btnPreview = Chat.e.btnPreview;
    Chat.setPreviewText = function(t){
      this.revealPreview(true).e.previewContent.innerHTML = t;
      this.e.previewArea.querySelectorAll('a').forEach(addAnchorTargetBlank);
      this.e.inputCurrent.focus();
    };
    /**
       Reveals preview area if showIt is true, else hides it.
       This also shows/hides other elements, "as appropriate."
    */
    Chat.revealPreview = function(showIt){
      if(showIt){
Changes to www/changes.wiki.
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
  *  Enhanced the [/help?cmd=/chat|/chat page] configuration and added the ability
     for a repository administrator to [./chat.md#notifications|extend the
     selection of notification sounds via unversioned files].
  *  The [/help?cmd=/chat|/chat] messages now use fossil's full complement of
     markdown features, instead of the prior small subset of markup it
     previously supported. This retroactively applies to all chat messages,
     as they are markdown-processed when they are sent instead of when they

     are saved. See [./chat.md#usage|the chat docs] for more details.

<h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
  *  <b>Security:</b> Fix the client-side TLS so that it verifies that the
     server hostname matches its certificate.
  *  The default "ssh" command on Windows is changed to "ssh" instead of the
     legacy "plink", as ssh is now generally available on Windows systems.
     Installations that still need to use the legacy "plink" can make that







>
|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  *  Enhanced the [/help?cmd=/chat|/chat page] configuration and added the ability
     for a repository administrator to [./chat.md#notifications|extend the
     selection of notification sounds via unversioned files].
  *  The [/help?cmd=/chat|/chat] messages now use fossil's full complement of
     markdown features, instead of the prior small subset of markup it
     previously supported. This retroactively applies to all chat messages,
     as they are markdown-processed when they are sent instead of when they
     are saved. Added a preview mode so messages can be previewed before
     being sent. See [./chat.md#usage|the chat docs] for more details.

<h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2>
  *  <b>Security:</b> Fix the client-side TLS so that it verifies that the
     server hostname matches its certificate.
  *  The default "ssh" command on Windows is changed to "ssh" instead of the
     legacy "plink", as ssh is now generally available on Windows systems.
     Installations that still need to use the legacy "plink" can make that