Fossil

Check-in [d369f4f3]
Login

Check-in [d369f4f3]

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d369f4f389c6a4471cdd314ea93e02d8552f5e5ba6da337f8c5f65eb9f56cf8c
User & Date: stephan 2020-09-17 17:13:33
Context
2020-09-17
17:17
Pedantic CSS tweaks. ... (check-in: 5b93a4da user: stephan tags: trunk)
17:13
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. ... (check-in: d369f4f3 user: stephan tags: trunk)
16:52
pikchr mode swap: tapping on an SVG switches modes and enables the mode-select button. Leaving source view mode requires activating that button (which works like before, but is only visible in source mode). ... (check-in: 2a2be013 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/fossil.pikchr.js.

150
151
152
153
154
155
156






157
158
159
160
161
162
163
164
      console.warn("No pikchr source node found in",parent);
      return this;
    }
    const buttonBar = D.addClass(D.span(), 'pikchr-button-bar');
    const btnFlip = D.append(
      D.addClass(D.span(), 'pikchr-src-button'),
    );






    D.append(buttonBar, btnFlip);
    // not yet sure which options we can/should support:
    // opt = F.mergeLastWins({},opt);
    D.addClass(srcView, 'hidden')/*should already be so, but just in case*/;
    D.append(parent, D.addClass(buttonBar, 'hidden'));

    parent.addEventListener('click', function f(ev){
      ev.preventDefault();







>
>
>
>
>
>
|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
      console.warn("No pikchr source node found in",parent);
      return this;
    }
    const buttonBar = D.addClass(D.span(), 'pikchr-button-bar');
    const btnFlip = D.append(
      D.addClass(D.span(), 'pikchr-src-button'),
    );
    const btnCopy = F.copyButton(D.span(), {
      cssClass: ['copy-button', 'pikchr-copy-button'],
      extractText: ()=>(srcView.classList.contains('hidden') ? svg.outerHTML : srcView.value),
      oncopy: ()=>D.flashOnce(btnCopy, ()=>btnFlip.click())
      // ^^^ after copying and flashing, flip back to SVG mode. */
    });
    D.append(buttonBar, btnFlip, btnCopy);
    // not yet sure which options we can/should support:
    // opt = F.mergeLastWins({},opt);
    D.addClass(srcView, 'hidden')/*should already be so, but just in case*/;
    D.append(parent, D.addClass(buttonBar, 'hidden'));

    parent.addEventListener('click', function f(ev){
      ev.preventDefault();