-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Desktop: preview mode fix #2576
Conversation
@Runo-saduwa nice work, didn't check the logic, just a few style comments. Small images of the relevant part of the screen would be nice, in the PR description, maybe showing before and after. The words have all the details, but pictures are sometimes clearer. |
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.
The problem with HTML notes is still not fixed.
HTML notes must not enable any of the menu items - no matter the viewing mode. You are very close. You almost got it.
I am still trying to set up Web Clipper to test this. as soon as i successfully set up Web Clipper on my browser, this issue will be resolved |
Just use the "normal" web clipper with your production Joplin insgtance. Then create a HTML note as I explained earlier, export it (jex), and import it into your dev Joplin instance. |
Or use this one: |
Thank You, I will give updates shortly |
Special thanks to @tessus |
@PackElend Please label me, thanks. |
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.
Apart from the empty line @mic704b mentioned, the PR looks good now.
Please delete the empty line.
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.
LGTM
Thanks for the quick review @tessus |
cd09be3
to
7e6b6c2
Compare
dbf19bc
to
545a8cd
Compare
@Runo-saduwa can you summarize you changes? This PR has a lot of comments, so it is quite challenging to follow it. |
@@ -1178,7 +1181,8 @@ class Application extends BaseApplication { | |||
for (const itemId of ['copy', 'paste', 'cut', 'selectAll', 'bold', 'italic', 'link', 'code', 'insertDateTime', 'commandStartExternalEditing', 'showLocalSearch']) { | |||
const menuItem = Menu.getApplicationMenu().getMenuItemById(`edit:${itemId}`); | |||
if (!menuItem) continue; | |||
menuItem.enabled = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN; | |||
const isHtmlNote = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_HTML; |
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.
So full condition should be const isHtmlNote = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_HTML;
based on this comment by Laurent, i have changed the code to use this. which will return true
if its a HTML note and false
if its not.
const isHtmlNote = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_HTML
@@ -1178,7 +1181,8 @@ class Application extends BaseApplication { | |||
for (const itemId of ['copy', 'paste', 'cut', 'selectAll', 'bold', 'italic', 'link', 'code', 'insertDateTime', 'commandStartExternalEditing', 'showLocalSearch']) { | |||
const menuItem = Menu.getApplicationMenu().getMenuItemById(`edit:${itemId}`); | |||
if (!menuItem) continue; | |||
menuItem.enabled = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN; | |||
const isHtmlNote = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_HTML; | |||
menuItem.enabled = !isHtmlNote && layout !== 'viewer' && !!note; |
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.
Then i modified the logic for enabling and disabling the menuItem
with this condition
!isHtmlNote && layout !== 'viewer' && !!note
which causes the same side-effects as this:
if(isHtmlNote || layout === 'viewer' || !note){
menuItem.enabled = false;
} else {
menuItem.enabled = true;
}
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.
Thanks, I think it now includes all the changes Laurent requested.
Anything left to do here or can we merge this? |
We got there eventually! Thanks @Runo-saduwa for the fix and everyone for reviewing. |
DESCRIPTION:
This patch is a fix for the issue #2467 . Previously before this solution, the Edit menu items were not disabled on PREVIEW, this caused users to be able to use short cuts such as CTRL+B, CTRL+` on PREVIEW mode which is an unwanted behavior.
HOW TO TEST
Use the following test cases to confirm this solution::
EXPECTED RESULT: 'copy', 'paste', 'cut', 'select all', 'bold', 'italic', 'link', 'code', 'insert Date Time', 'Start External Editing', 'show Local Search' should be disabled
EXPECTED RESULT: 'copy', 'paste', 'cut', 'select all', 'bold', 'italic', 'link', 'code', 'insert Date Time', 'Start External Editing', 'show Local Search' should be enabled
EXPECTED RESULT: 'copy', 'paste', 'cut', 'select all', 'bold', 'italic', 'link', 'code', 'insert Date Time', 'Start External Editing', 'show Local Search' should be enabled
EXPECTED RESULT: 'copy', 'paste', 'cut', 'select all', 'bold', 'italic', 'link', 'code', 'insert Date Time', 'Start External Editing', 'show Local Search' should be disabled
EXPECTED RESULT: 'copy', 'paste', 'cut', 'select all', 'bold', 'italic', 'link', 'code', 'insert Date Time', 'Start External Editing', 'show Local Search' should be disabled