Fossil SCM
s/f-post-/f-preview-/.
Commit
99bd288bcee68411d7eb85c14e560b8dbd1aafefc0d10d47e7250b6a0f81b969
Parent
7ede6122e575be2…
2 files changed
+3
-3
+18
-18
+3
-3
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1603,15 +1603,15 @@ | ||
| 1603 | 1603 | "data-tab-label='Preview'" |
| 1604 | 1604 | ">"); |
| 1605 | 1605 | |
| 1606 | 1606 | CX("<div class='fileedit-options flex-container row'>"); |
| 1607 | 1607 | CX("<button id='btn-preview-refresh' " |
| 1608 | - "data-f-post-from='fileedit-content-editor' " | |
| 1608 | + "data-f-preview-from='fileedit-content-editor' " | |
| 1609 | 1609 | /* ^^^ text source elem ID*/ |
| 1610 | - "data-f-post-via='_postPreview' " | |
| 1610 | + "data-f-preview-via='_postPreview' " | |
| 1611 | 1611 | /* ^^^ fossil.page[methodName](content, callback) */ |
| 1612 | - "data-f-post-to='fileedit-tab-preview-wrapper' " | |
| 1612 | + "data-f-preview-to='fileedit-tab-preview-wrapper' " | |
| 1613 | 1613 | /* ^^^ dest elem ID */ |
| 1614 | 1614 | ">Refresh</button>"); |
| 1615 | 1615 | /* Default preview rendering mode selection... */ |
| 1616 | 1616 | previewRenderMode = fileedit_render_mode_for_mimetype(zFileMime); |
| 1617 | 1617 | style_select_list_int("select-preview-mode", |
| 1618 | 1618 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1603,15 +1603,15 @@ | |
| 1603 | "data-tab-label='Preview'" |
| 1604 | ">"); |
| 1605 | |
| 1606 | CX("<div class='fileedit-options flex-container row'>"); |
| 1607 | CX("<button id='btn-preview-refresh' " |
| 1608 | "data-f-post-from='fileedit-content-editor' " |
| 1609 | /* ^^^ text source elem ID*/ |
| 1610 | "data-f-post-via='_postPreview' " |
| 1611 | /* ^^^ fossil.page[methodName](content, callback) */ |
| 1612 | "data-f-post-to='fileedit-tab-preview-wrapper' " |
| 1613 | /* ^^^ dest elem ID */ |
| 1614 | ">Refresh</button>"); |
| 1615 | /* Default preview rendering mode selection... */ |
| 1616 | previewRenderMode = fileedit_render_mode_for_mimetype(zFileMime); |
| 1617 | style_select_list_int("select-preview-mode", |
| 1618 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1603,15 +1603,15 @@ | |
| 1603 | "data-tab-label='Preview'" |
| 1604 | ">"); |
| 1605 | |
| 1606 | CX("<div class='fileedit-options flex-container row'>"); |
| 1607 | CX("<button id='btn-preview-refresh' " |
| 1608 | "data-f-preview-from='fileedit-content-editor' " |
| 1609 | /* ^^^ text source elem ID*/ |
| 1610 | "data-f-preview-via='_postPreview' " |
| 1611 | /* ^^^ fossil.page[methodName](content, callback) */ |
| 1612 | "data-f-preview-to='fileedit-tab-preview-wrapper' " |
| 1613 | /* ^^^ dest elem ID */ |
| 1614 | ">Refresh</button>"); |
| 1615 | /* Default preview rendering mode selection... */ |
| 1616 | previewRenderMode = fileedit_render_mode_for_mimetype(zFileMime); |
| 1617 | style_select_list_int("select-preview-mode", |
| 1618 |
+18
-18
| --- src/fossil.bootstrap.js | ||
| +++ src/fossil.bootstrap.js | ||
| @@ -154,41 +154,41 @@ | ||
| 154 | 154 | - A CSS selector |
| 155 | 155 | |
| 156 | 156 | Each element in the collection must have the following data |
| 157 | 157 | attributes: |
| 158 | 158 | |
| 159 | - - data-f-post-from: the DOM element id of the text source | |
| 159 | + - data-f-preview-from: the DOM element id of the text source | |
| 160 | 160 | element. It must support .value to get the content. |
| 161 | 161 | |
| 162 | - - data-f-post-to: the DOM element id of the target "previewer" | |
| 162 | + - data-f-preview-to: the DOM element id of the target "previewer" | |
| 163 | 163 | element. |
| 164 | 164 | |
| 165 | - - data-f-post-via: the name of a method (see below). | |
| 165 | + - data-f-preview-via: the name of a method (see below). | |
| 166 | 166 | |
| 167 | - - OPTIONAL data-f-post-as-text: a numeric value. Explained below. | |
| 167 | + - OPTIONAL data-f-preview-as-text: a numeric value. Explained below. | |
| 168 | 168 | |
| 169 | 169 | Each element gets a click handler added to it which does the |
| 170 | 170 | following: |
| 171 | 171 | |
| 172 | - 1) Reads the content from its data-f-post-from element. | |
| 172 | + 1) Reads the content from its data-f-preview-from element. | |
| 173 | 173 | |
| 174 | 174 | 2) Passes the content to |
| 175 | 175 | methodNamespace[f-data-post-via](content,callback). f-data-post-via |
| 176 | 176 | is responsible for submitting the preview HTTP request, including |
| 177 | 177 | any parameters the request might require. When the response |
| 178 | 178 | arrives, it must pass the content of the response to its 2nd |
| 179 | 179 | argument, an auto-generated callback installed by this mechanism |
| 180 | 180 | which... |
| 181 | 181 | |
| 182 | - 3) Assigns the response text to the data-f-post-to element. If | |
| 183 | - data-f-post-as-text is '0' (the default) then the content | |
| 182 | + 3) Assigns the response text to the data-f-preview-to element. If | |
| 183 | + data-f-preview-as-text is '0' (the default) then the content | |
| 184 | 184 | is assigned to the target element's innerHTML property, else |
| 185 | 185 | it is assigned to the element's textContent property. |
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | The methodNamespace (2nd argument) defaults to fossil.page, and |
| 189 | - data-f-post-via must be a single method name, not a | |
| 189 | + data-f-preview-via must be a single method name, not a | |
| 190 | 190 | property-access-style string. e.g. "myPreview" is legal but |
| 191 | 191 | "foo.myPreview" is not (unless, of course, the method is actually |
| 192 | 192 | named "foo.myPreview" (which is legal but would be |
| 193 | 193 | unconventional)). |
| 194 | 194 | |
| @@ -195,16 +195,16 @@ | ||
| 195 | 195 | An example... |
| 196 | 196 | |
| 197 | 197 | First an input button: |
| 198 | 198 | |
| 199 | 199 | <button id='test-preview-connector' |
| 200 | - data-f-post-from='fileedit-content-editor' // elem ID | |
| 201 | - data-f-post-via='myPreview' // method name | |
| 202 | - data-f-post-to='fileedit-tab-preview-wrapper' // elem ID | |
| 200 | + data-f-preview-from='fileedit-content-editor' // elem ID | |
| 201 | + data-f-preview-via='myPreview' // method name | |
| 202 | + data-f-preview-to='fileedit-tab-preview-wrapper' // elem ID | |
| 203 | 203 | >Preview update</button> |
| 204 | 204 | |
| 205 | - And a sample data-f-post-via method: | |
| 205 | + And a sample data-f-preview-via method: | |
| 206 | 206 | |
| 207 | 207 | fossil.page.myPreview = function(content,callback){ |
| 208 | 208 | const fd = new FormData(); |
| 209 | 209 | fd.append('foo', ...); |
| 210 | 210 | fossil.fetch('preview_forumpost',{ |
| @@ -219,12 +219,12 @@ | ||
| 219 | 219 | |
| 220 | 220 | Then connect the parts with: |
| 221 | 221 | |
| 222 | 222 | fossil.connectPagePreviewers('#test-preview-connector'); |
| 223 | 223 | |
| 224 | - Note that the data-f-post-from, data-f-post-via, and | |
| 225 | - data-f-post-to selector are not resolved until the button is | |
| 224 | + Note that the data-f-preview-from, data-f-preview-via, and | |
| 225 | + data-f-preview-to selector are not resolved until the button is | |
| 226 | 226 | actually clicked, so they need not exist in the DOM at the |
| 227 | 227 | instant when the connection is set up, so long as they can be |
| 228 | 228 | resolved when the preview-refreshing element is clicked. |
| 229 | 229 | */ |
| 230 | 230 | F.connectPagePreviewers = function f(selector,methodNamespace){ |
| @@ -237,15 +237,15 @@ | ||
| 237 | 237 | methodNamespace = F.page; |
| 238 | 238 | } |
| 239 | 239 | selector.forEach(function(e){ |
| 240 | 240 | e.addEventListener( |
| 241 | 241 | 'click', function(r){ |
| 242 | - const eTo = document.querySelector('#'+e.dataset.fPostTo), | |
| 243 | - eFrom = document.querySelector('#'+e.dataset.fPostFrom), | |
| 244 | - asText = +(e.dataset.fPostAsText || 0); | |
| 242 | + const eTo = document.querySelector('#'+e.dataset.fPreviewTo), | |
| 243 | + eFrom = document.querySelector('#'+e.dataset.fPreviewFrom), | |
| 244 | + asText = +(e.dataset.fPreviewAsText || 0); | |
| 245 | 245 | eTo.textContent = "Fetching preview..."; |
| 246 | - methodNamespace[e.dataset.fPostVia]( | |
| 246 | + methodNamespace[e.dataset.fPreviewVia]( | |
| 247 | 247 | eFrom.value, |
| 248 | 248 | (r)=>eTo[asText ? 'textContent' : 'innerHTML'] = r||'' |
| 249 | 249 | ); |
| 250 | 250 | }, false |
| 251 | 251 | ); |
| 252 | 252 |
| --- src/fossil.bootstrap.js | |
| +++ src/fossil.bootstrap.js | |
| @@ -154,41 +154,41 @@ | |
| 154 | - A CSS selector |
| 155 | |
| 156 | Each element in the collection must have the following data |
| 157 | attributes: |
| 158 | |
| 159 | - data-f-post-from: the DOM element id of the text source |
| 160 | element. It must support .value to get the content. |
| 161 | |
| 162 | - data-f-post-to: the DOM element id of the target "previewer" |
| 163 | element. |
| 164 | |
| 165 | - data-f-post-via: the name of a method (see below). |
| 166 | |
| 167 | - OPTIONAL data-f-post-as-text: a numeric value. Explained below. |
| 168 | |
| 169 | Each element gets a click handler added to it which does the |
| 170 | following: |
| 171 | |
| 172 | 1) Reads the content from its data-f-post-from element. |
| 173 | |
| 174 | 2) Passes the content to |
| 175 | methodNamespace[f-data-post-via](content,callback). f-data-post-via |
| 176 | is responsible for submitting the preview HTTP request, including |
| 177 | any parameters the request might require. When the response |
| 178 | arrives, it must pass the content of the response to its 2nd |
| 179 | argument, an auto-generated callback installed by this mechanism |
| 180 | which... |
| 181 | |
| 182 | 3) Assigns the response text to the data-f-post-to element. If |
| 183 | data-f-post-as-text is '0' (the default) then the content |
| 184 | is assigned to the target element's innerHTML property, else |
| 185 | it is assigned to the element's textContent property. |
| 186 | |
| 187 | |
| 188 | The methodNamespace (2nd argument) defaults to fossil.page, and |
| 189 | data-f-post-via must be a single method name, not a |
| 190 | property-access-style string. e.g. "myPreview" is legal but |
| 191 | "foo.myPreview" is not (unless, of course, the method is actually |
| 192 | named "foo.myPreview" (which is legal but would be |
| 193 | unconventional)). |
| 194 | |
| @@ -195,16 +195,16 @@ | |
| 195 | An example... |
| 196 | |
| 197 | First an input button: |
| 198 | |
| 199 | <button id='test-preview-connector' |
| 200 | data-f-post-from='fileedit-content-editor' // elem ID |
| 201 | data-f-post-via='myPreview' // method name |
| 202 | data-f-post-to='fileedit-tab-preview-wrapper' // elem ID |
| 203 | >Preview update</button> |
| 204 | |
| 205 | And a sample data-f-post-via method: |
| 206 | |
| 207 | fossil.page.myPreview = function(content,callback){ |
| 208 | const fd = new FormData(); |
| 209 | fd.append('foo', ...); |
| 210 | fossil.fetch('preview_forumpost',{ |
| @@ -219,12 +219,12 @@ | |
| 219 | |
| 220 | Then connect the parts with: |
| 221 | |
| 222 | fossil.connectPagePreviewers('#test-preview-connector'); |
| 223 | |
| 224 | Note that the data-f-post-from, data-f-post-via, and |
| 225 | data-f-post-to selector are not resolved until the button is |
| 226 | actually clicked, so they need not exist in the DOM at the |
| 227 | instant when the connection is set up, so long as they can be |
| 228 | resolved when the preview-refreshing element is clicked. |
| 229 | */ |
| 230 | F.connectPagePreviewers = function f(selector,methodNamespace){ |
| @@ -237,15 +237,15 @@ | |
| 237 | methodNamespace = F.page; |
| 238 | } |
| 239 | selector.forEach(function(e){ |
| 240 | e.addEventListener( |
| 241 | 'click', function(r){ |
| 242 | const eTo = document.querySelector('#'+e.dataset.fPostTo), |
| 243 | eFrom = document.querySelector('#'+e.dataset.fPostFrom), |
| 244 | asText = +(e.dataset.fPostAsText || 0); |
| 245 | eTo.textContent = "Fetching preview..."; |
| 246 | methodNamespace[e.dataset.fPostVia]( |
| 247 | eFrom.value, |
| 248 | (r)=>eTo[asText ? 'textContent' : 'innerHTML'] = r||'' |
| 249 | ); |
| 250 | }, false |
| 251 | ); |
| 252 |
| --- src/fossil.bootstrap.js | |
| +++ src/fossil.bootstrap.js | |
| @@ -154,41 +154,41 @@ | |
| 154 | - A CSS selector |
| 155 | |
| 156 | Each element in the collection must have the following data |
| 157 | attributes: |
| 158 | |
| 159 | - data-f-preview-from: the DOM element id of the text source |
| 160 | element. It must support .value to get the content. |
| 161 | |
| 162 | - data-f-preview-to: the DOM element id of the target "previewer" |
| 163 | element. |
| 164 | |
| 165 | - data-f-preview-via: the name of a method (see below). |
| 166 | |
| 167 | - OPTIONAL data-f-preview-as-text: a numeric value. Explained below. |
| 168 | |
| 169 | Each element gets a click handler added to it which does the |
| 170 | following: |
| 171 | |
| 172 | 1) Reads the content from its data-f-preview-from element. |
| 173 | |
| 174 | 2) Passes the content to |
| 175 | methodNamespace[f-data-post-via](content,callback). f-data-post-via |
| 176 | is responsible for submitting the preview HTTP request, including |
| 177 | any parameters the request might require. When the response |
| 178 | arrives, it must pass the content of the response to its 2nd |
| 179 | argument, an auto-generated callback installed by this mechanism |
| 180 | which... |
| 181 | |
| 182 | 3) Assigns the response text to the data-f-preview-to element. If |
| 183 | data-f-preview-as-text is '0' (the default) then the content |
| 184 | is assigned to the target element's innerHTML property, else |
| 185 | it is assigned to the element's textContent property. |
| 186 | |
| 187 | |
| 188 | The methodNamespace (2nd argument) defaults to fossil.page, and |
| 189 | data-f-preview-via must be a single method name, not a |
| 190 | property-access-style string. e.g. "myPreview" is legal but |
| 191 | "foo.myPreview" is not (unless, of course, the method is actually |
| 192 | named "foo.myPreview" (which is legal but would be |
| 193 | unconventional)). |
| 194 | |
| @@ -195,16 +195,16 @@ | |
| 195 | An example... |
| 196 | |
| 197 | First an input button: |
| 198 | |
| 199 | <button id='test-preview-connector' |
| 200 | data-f-preview-from='fileedit-content-editor' // elem ID |
| 201 | data-f-preview-via='myPreview' // method name |
| 202 | data-f-preview-to='fileedit-tab-preview-wrapper' // elem ID |
| 203 | >Preview update</button> |
| 204 | |
| 205 | And a sample data-f-preview-via method: |
| 206 | |
| 207 | fossil.page.myPreview = function(content,callback){ |
| 208 | const fd = new FormData(); |
| 209 | fd.append('foo', ...); |
| 210 | fossil.fetch('preview_forumpost',{ |
| @@ -219,12 +219,12 @@ | |
| 219 | |
| 220 | Then connect the parts with: |
| 221 | |
| 222 | fossil.connectPagePreviewers('#test-preview-connector'); |
| 223 | |
| 224 | Note that the data-f-preview-from, data-f-preview-via, and |
| 225 | data-f-preview-to selector are not resolved until the button is |
| 226 | actually clicked, so they need not exist in the DOM at the |
| 227 | instant when the connection is set up, so long as they can be |
| 228 | resolved when the preview-refreshing element is clicked. |
| 229 | */ |
| 230 | F.connectPagePreviewers = function f(selector,methodNamespace){ |
| @@ -237,15 +237,15 @@ | |
| 237 | methodNamespace = F.page; |
| 238 | } |
| 239 | selector.forEach(function(e){ |
| 240 | e.addEventListener( |
| 241 | 'click', function(r){ |
| 242 | const eTo = document.querySelector('#'+e.dataset.fPreviewTo), |
| 243 | eFrom = document.querySelector('#'+e.dataset.fPreviewFrom), |
| 244 | asText = +(e.dataset.fPreviewAsText || 0); |
| 245 | eTo.textContent = "Fetching preview..."; |
| 246 | methodNamespace[e.dataset.fPreviewVia]( |
| 247 | eFrom.value, |
| 248 | (r)=>eTo[asText ? 'textContent' : 'innerHTML'] = r||'' |
| 249 | ); |
| 250 | }, false |
| 251 | ); |
| 252 |