Fossil SCM
pikchr source view: tentatively re-added the copy button (only in source view, not SVG), but it now switches back to SVG mode if it successfully copies the source code.
Commit
d369f4f389c6a4471cdd314ea93e02d8552f5e5ba6da337f8c5f65eb9f56cf8c
Parent
2a2be013199e051…
1 file changed
+7
-1
+7
-1
| --- src/fossil.pikchr.js | ||
| +++ src/fossil.pikchr.js | ||
| @@ -152,11 +152,17 @@ | ||
| 152 | 152 | } |
| 153 | 153 | const buttonBar = D.addClass(D.span(), 'pikchr-button-bar'); |
| 154 | 154 | const btnFlip = D.append( |
| 155 | 155 | D.addClass(D.span(), 'pikchr-src-button'), |
| 156 | 156 | ); |
| 157 | - D.append(buttonBar, btnFlip); | |
| 157 | + const btnCopy = F.copyButton(D.span(), { | |
| 158 | + cssClass: ['copy-button', 'pikchr-copy-button'], | |
| 159 | + extractText: ()=>(srcView.classList.contains('hidden') ? svg.outerHTML : srcView.value), | |
| 160 | + oncopy: ()=>D.flashOnce(btnCopy, ()=>btnFlip.click()) | |
| 161 | + // ^^^ after copying and flashing, flip back to SVG mode. */ | |
| 162 | + }); | |
| 163 | + D.append(buttonBar, btnFlip, btnCopy); | |
| 158 | 164 | // not yet sure which options we can/should support: |
| 159 | 165 | // opt = F.mergeLastWins({},opt); |
| 160 | 166 | D.addClass(srcView, 'hidden')/*should already be so, but just in case*/; |
| 161 | 167 | D.append(parent, D.addClass(buttonBar, 'hidden')); |
| 162 | 168 | |
| 163 | 169 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -152,11 +152,17 @@ | |
| 152 | } |
| 153 | const buttonBar = D.addClass(D.span(), 'pikchr-button-bar'); |
| 154 | const btnFlip = D.append( |
| 155 | D.addClass(D.span(), 'pikchr-src-button'), |
| 156 | ); |
| 157 | D.append(buttonBar, btnFlip); |
| 158 | // not yet sure which options we can/should support: |
| 159 | // opt = F.mergeLastWins({},opt); |
| 160 | D.addClass(srcView, 'hidden')/*should already be so, but just in case*/; |
| 161 | D.append(parent, D.addClass(buttonBar, 'hidden')); |
| 162 | |
| 163 |
| --- src/fossil.pikchr.js | |
| +++ src/fossil.pikchr.js | |
| @@ -152,11 +152,17 @@ | |
| 152 | } |
| 153 | const buttonBar = D.addClass(D.span(), 'pikchr-button-bar'); |
| 154 | const btnFlip = D.append( |
| 155 | D.addClass(D.span(), 'pikchr-src-button'), |
| 156 | ); |
| 157 | const btnCopy = F.copyButton(D.span(), { |
| 158 | cssClass: ['copy-button', 'pikchr-copy-button'], |
| 159 | extractText: ()=>(srcView.classList.contains('hidden') ? svg.outerHTML : srcView.value), |
| 160 | oncopy: ()=>D.flashOnce(btnCopy, ()=>btnFlip.click()) |
| 161 | // ^^^ after copying and flashing, flip back to SVG mode. */ |
| 162 | }); |
| 163 | D.append(buttonBar, btnFlip, btnCopy); |
| 164 | // not yet sure which options we can/should support: |
| 165 | // opt = F.mergeLastWins({},opt); |
| 166 | D.addClass(srcView, 'hidden')/*should already be so, but just in case*/; |
| 167 | D.append(parent, D.addClass(buttonBar, 'hidden')); |
| 168 | |
| 169 |