-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial open note-link functionality (#313) #691
Add initial open note-link functionality (#313) #691
Conversation
8439c97
to
0b40fa5
Compare
src/lib/addons/hyperlink.js
Outdated
@@ -0,0 +1,183 @@ | |||
export function initHyperlink(CodeMirror) { | |||
'use strict' | |||
const shell = window.require('electron').shell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use electron directly. It could cause lots of problems. I thought I disabled it but apparently, I didn't do it yet. Please use main-preload.js
and lib/electronOnly.ts
module to expose electron and native nodejs apis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sure, still learning the API.
Updated the needed changes, it seems to work nicely now (also fixed macOS binding, and non-initialized getWebContentsById)
Is there a way to know the ID rather than guessing it's id=1 (since we have one window?)
Should we maybe have getCurrentWindow (or getCurrentWindowWebContents), or set id explicitly to be sure (for further changes)?
Also, should I check if we are in electron when using electorn only API?
decc5de
to
0ff12f9
Compare
dc062f6
to
c23e377
Compare
11bfcf3
to
ad59f9b
Compare
Add copy note link menu option (NoteItem.tsx) Update db API for creating a note link (createstore, FSNoteDb, PouchNoteDb) Add codemirror hyperlink addon Add codemirror hyperlink addon css style (CodeEditor.tsx) Initialize hyperlink addon (CodeMirror.ts) Add event handling of editor ctrl+click link with ipc (App.tsx) Add regexes for note link shortId (MarkdownPreviewer.tsx) Add handling of rendering and clicking of note link in md preview Fix electron only API Fix getWebContentsById to be initialized Fix hyperlink to use electron only API Fix macos binding in hyperlink Refactor utility functions and put regexes in constants Fix note linking when title contains characters that should be escaped Add note link copied push message Add push message when note link is successfully copied Update note link after rebase v0.14.3 Add copy note link in NoteNavigatorItem Fix issues with event default propagation on context menu
01a091f
to
3b25256
Compare
@Rokt33r can cloud internal note linking be used instead of this, is it shared component, can we make it so? |
Closing in favor of new local space only repository, it will be rebased and opened there. |
Based on BoostIO/BoostNote-App#691 Changes pulled in from original patch: - Update db API for creating a note link (createstore, FSNoteDb) - Add codemirror hyperlink addon - Initialize hyperlink addon (CodeMirror.ts) - Add event handling of editor ctrl+click link with ipc (App.tsx) - Add regexes for note link shortId (MarkdownPreviewer.tsx) - Add handling of rendering and clicking of note link in md preview - Fix electron only API - Fix getWebContentsById to be initialized - Fix hyperlink to use electron only API - Fix macos binding in hyperlink - Refactor utility functions and put regexes in constants - Fix note linking when title contains characters that should be escaped - Add note link copied push message - Add push message when note link is successfully copied - Fix issues with event default propagation on context menu Differences from original patch: - Removed PouchNoteDb support - Migrated to V2 API for context menu in sidebar - Removed codemirror hyperlink addon css style (CodeEditor.tsx) Co-authored-by: Elliot Miller <elliot@bitoffdev.com> Co-authored-by: Komediruzecki <komediruzecki.2015@gmail.com>
Based on BoostIO/BoostNote-App#691 Changes pulled in from original patch: - Update db API for creating a note link (createstore, FSNoteDb) - Add codemirror hyperlink addon - Initialize hyperlink addon (CodeMirror.ts) - Add event handling of editor ctrl+click link with ipc (App.tsx) - Add regexes for note link shortId (MarkdownPreviewer.tsx) - Add handling of rendering and clicking of note link in md preview - Fix electron only API - Fix getWebContentsById to be initialized - Fix hyperlink to use electron only API - Fix macos binding in hyperlink - Refactor utility functions and put regexes in constants - Fix note linking when title contains characters that should be escaped - Add note link copied push message - Add push message when note link is successfully copied - Fix issues with event default propagation on context menu Differences from original patch: - Removed PouchNoteDb support - Migrated to V2 API for context menu in sidebar - Removed codemirror hyperlink addon css style (CodeEditor.tsx) Co-authored-by: Elliot Miller <elliot@bitoffdev.com> Co-authored-by: Komediruzecki <komediruzecki.2015@gmail.com>
Add note-link functionality (#313)
Add copy note link menu option (NoteItem.tsx)
Update db API for creating a note link (createstore, FSNoteDb, PouchNoteDb)
Add codemirror hyperlink addon
Add codemirror hyperlink addon css style (CodeEditor.tsx)
Initialize hyperlink addon (CodeMirror.ts)
Add event handling of editor ctrl+click link with ipc (App.tsx)
Add regexes for note link shortId (MarkdownPreviewer.tsx)
Add handling of rendering and clicking of note link in md preview
Fix invalid logic in prependNoteIdPrefix (should return prefixed noteId when no prefix is found)
Fix electron only API
Fix getWebContentsById to be initialized
Fix hyperlink to use electron only API
Fix macos binding in hyperlink
Copy link option:
Hovering over note link inside editor:
Hovering on note link in markdown preview:
Test:
In electron Linux App (dev)
In electron Linux App production version (appImage)
Improvements: