Skip to content

feat: bug report page & clipboard data inspector#8317

Merged
andelf merged 32 commits intologseq:masterfrom
situ2001:feat/bug-report
Jan 12, 2023
Merged

feat: bug report page & clipboard data inspector#8317
andelf merged 32 commits intologseq:masterfrom
situ2001:feat/bug-report

Conversation

@situ2001
Copy link
Copy Markdown
Contributor

close #8309

@cnrpman I made a simple bug report page and a clipboard data inspector.

Mechanism of clipboard data inspector

When a paste event occurs, the inspector does these things.

  1. Extract clipboard data (.-clipboardData e)
  2. Parse (.-items data) => Array<{kind:string, type:string}>
  3. Parse (.-types data) => Array<{kind:string, data: string}>. Notes that data is read by (.getData data type)
  4. Parse (.-files data) => Array<{name:string, type:string, size:number}>
  5. conj then into a {}

For example, if I copy these codes from vscode.

#?(:cljs
   (defn copy-to-clipboard!
     ([s]
      (utils/writeClipboard (clj->js {:text s})))
     ([s html]
      (utils/writeClipboard (clj->js {:text s :html html})))))

The output will be

{
  "items": [
    {
      "kind": "string",
      "type": "text/plain"
    },
    {
      "kind": "string",
      "type": "text/html"
    },
    {
      "kind": "string",
      "type": "vscode-editor-data"
    }
  ],
  "types": [
    {
      "type": "text/plain",
      "data": "#?(:cljs\n   (defn copy-to-clipboard!\n     ([s]\n      (utils/writeClipboard (clj->js {:text s})))\n     ([s html]\n      (utils/writeClipboard (clj->js {:text s :html html})))))"
    },
    {
      "type": "text/html",
      "data": "<meta charset='utf-8'><div style=\"color: #abb2bf;background-color: #23272e;font-family: Fira Code ,PingFang SC, Menlo, Monaco, 'Courier New', monospace;font-weight: normal;font-size: 12px;line-height: 18px;white-space: pre;\"><div><span style=\"color: #abb2bf;\">#?(</span><span style=\"color: #56b6c2;\">:cljs</span></div><div><span style=\"color: #abb2bf;\">   (</span><span style=\"color: #d19a66;\">defn</span><span style=\"color: #abb2bf;\"> </span><span style=\"color: #61afef;\">copy-to-clipboard!</span></div><div><span style=\"color: #abb2bf;\">     ([</span><span style=\"color: #e06c75;\">s</span><span style=\"color: #abb2bf;\">]</span></div><div><span style=\"color: #abb2bf;\">      (</span><span style=\"color: #e5c07b;\">utils</span><span style=\"color: #e06c75;\">/</span><span style=\"color: #61afef;\">writeClipboard</span><span style=\"color: #abb2bf;\"> (</span><span style=\"color: #61afef;\">clj-&gt;js</span><span style=\"color: #abb2bf;\"> {</span><span style=\"color: #c678dd;\">:text</span><span style=\"color: #abb2bf;\"> </span><span style=\"color: #e06c75;\">s</span><span style=\"color: #abb2bf;\">})))</span></div><div><span style=\"color: #abb2bf;\">     ([</span><span style=\"color: #e06c75;\">s</span><span style=\"color: #abb2bf;\"> </span><span style=\"color: #e06c75;\">html</span><span style=\"color: #abb2bf;\">]</span></div><div><span style=\"color: #abb2bf;\">      (</span><span style=\"color: #e5c07b;\">utils</span><span style=\"color: #e06c75;\">/</span><span style=\"color: #61afef;\">writeClipboard</span><span style=\"color: #abb2bf;\"> (</span><span style=\"color: #61afef;\">clj-&gt;js</span><span style=\"color: #abb2bf;\"> {</span><span style=\"color: #c678dd;\">:text</span><span style=\"color: #abb2bf;\"> </span><span style=\"color: #e06c75;\">s</span><span style=\"color: #abb2bf;\"> </span><span style=\"color: #c678dd;\">:html</span><span style=\"color: #abb2bf;\"> </span><span style=\"color: #e06c75;\">html</span><span style=\"color: #abb2bf;\">})))))</span></div></div>"
    },
    {
      "type": "vscode-editor-data",
      "data": "{\"version\":1,\"isFromEmptySelection\":false,\"multicursorText\":null,\"mode\":\"clojure\"}"
    }
  ],
  "files": []
}

Screenshots

image

Clipboard data can be collected on both PC and phone.

Kapture.2023-01-12.at.12.52.24.mp4
Kapture.2023-01-12.at.13.00.36.mp4

Reviews

  • Polish the English expression, if needed.
  • Point out any UX issues.

{:name :bug-report
:view bug-report/bug-report}]

["/bug-report-tool/:tool"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: Better hide it under "Developer mode".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO hiding it in Dev mode is not a good idea 👀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is a feature orienting to the users. 🤔

@cnrpman
Copy link
Copy Markdown
Collaborator

cnrpman commented Jan 12, 2023

Just rebase to the current master. It's upgraded to Electron 20
Follow steps may required:
yarn
yarn watch
In another window:
cd static
yarn
cd ..
yarn dev-electron-app and kill all electron process
Then a normal start happens

Copy link
Copy Markdown
Collaborator

@cnrpman cnrpman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just made some UX tuning:
Unifiy the buttons
image
Finetune the input box and add a Go back but
image

@Bad3r Bad3r added this to the 0.8.16 milestone Jan 12, 2023
Copy link
Copy Markdown
Collaborator

@Bad3r Bad3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it only works with the default light theme:
 

@situ2001
Copy link
Copy Markdown
Contributor Author

it only works with the default light theme:  

Fixed.

Kapture 2023-01-12 at 19 34 25

Copy link
Copy Markdown
Collaborator

@andelf andelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Let's deliver it.

@andelf andelf merged commit 7fd2a9a into logseq:master Jan 12, 2023
logseq-cldwalker added a commit that referenced this pull request Jan 12, 2023
Also add missing label to bug report url
cnrpman added a commit to cnrpman/logseq that referenced this pull request Jan 12, 2023
* feat: init page route for bug-report
* feat: navigate to bug-report page in dropdown-menu
* feat: add route for bug report tools
* feat: export clipboard to map
* fix: set-step! in promise and remove unused state
* chore: there is no need to actively read from clipboard, just waiting copy-paste from user
* chore: only parse dataTransfer
* feat: initially done the clipboard data inspector
* fix: use `util/copy-to-clipboard!` instead
* feat: init page route for bug-report
* feat: navigate to bug-report page in dropdown-menu
* feat: add route for bug report tools
* feat: export clipboard to map
* fix: set-step! in promise and remove unused state
* feat: initially done the clipboard data inspector
* fix: use `util/copy-to-clipboard!` instead
* fix: remove unused `:require`
* ux: finetune clipbard inspector and bug report
* feat: component `report-item-button`
* fix: update text for clarity
* fix: add subtext to button to fix lint error
* fix: add missing argument
* fix: change bg color to logseq css variable
* fix: remove redundant div box in `report-item-button`

Co-authored-by: Junyi Du <junyidu.cn@gmail.com>
Co-authored-by: Bad3r <bad3r@protonmail.com>
cnrpman pushed a commit to cnrpman/logseq that referenced this pull request Jan 12, 2023
Also add missing label to bug report url
cnrpman pushed a commit that referenced this pull request Jan 12, 2023
Also add missing label to bug report url
Comment on lines +61 to +64
[:input.form-input.is-large.transition.duration-150.ease-in-out {:type "text" :placeholder "Long press here to paste if you are on mobile"}]
[:div.flex.justify-between.items-center.mt-2
[:div "Something wrong? No problem, click here to go to the previous step."]
(ui/button "Go back" :on-click #(util/open-url (rfe/href :bug-report)))]))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This :on-click pointed here will mess up the history stack since it pushes the href to the stack instead of popping, as the following screen recording shows.

Kapture.2023-01-15.at.16.19.51.mp4

sallto pushed a commit to sallto/logseq that referenced this pull request Jan 18, 2023
* feat: init page route for bug-report
* feat: navigate to bug-report page in dropdown-menu
* feat: add route for bug report tools
* feat: export clipboard to map
* fix: set-step! in promise and remove unused state
* chore: there is no need to actively read from clipboard, just waiting copy-paste from user
* chore: only parse dataTransfer
* feat: initially done the clipboard data inspector
* fix: use `util/copy-to-clipboard!` instead
* feat: init page route for bug-report
* feat: navigate to bug-report page in dropdown-menu
* feat: add route for bug report tools
* feat: export clipboard to map
* fix: set-step! in promise and remove unused state
* feat: initially done the clipboard data inspector
* fix: use `util/copy-to-clipboard!` instead
* fix: remove unused `:require`
* ux: finetune clipbard inspector and bug report
* feat: component `report-item-button`
* fix: update text for clarity
* fix: add subtext to button to fix lint error
* fix: add missing argument
* fix: change bg color to logseq css variable
* fix: remove redundant div box in `report-item-button`

Co-authored-by: Junyi Du <junyidu.cn@gmail.com>
Co-authored-by: Bad3r <bad3r@protonmail.com>
sallto pushed a commit to sallto/logseq that referenced this pull request Jan 18, 2023
Also add missing label to bug report url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need debug mechanism for capturing clipboard meta data to enable improving the copy-paste experience

4 participants