You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-18 23:07:45 +02:00
Desktop: TinyMCE: Fixed clicking a link within a checkbox label
This commit is contained in:
@ -2103,6 +2103,8 @@
|
|||||||
var editorClickHandler = function (event) {
|
var editorClickHandler = function (event) {
|
||||||
if (!isJoplinChecklistItem(event.target))
|
if (!isJoplinChecklistItem(event.target))
|
||||||
return;
|
return;
|
||||||
|
if (event.offsetX >= 0)
|
||||||
|
return;
|
||||||
editor.execCommand('ToggleJoplinChecklistItem', false, { element: event.target });
|
editor.execCommand('ToggleJoplinChecklistItem', false, { element: event.target });
|
||||||
};
|
};
|
||||||
if (options.listType === 'joplinChecklist') {
|
if (options.listType === 'joplinChecklist') {
|
||||||
|
@ -40,6 +40,20 @@ const listState = function (editor: Editor, listName, options:any = {}) {
|
|||||||
|
|
||||||
const editorClickHandler = (event) => {
|
const editorClickHandler = (event) => {
|
||||||
if (!isJoplinChecklistItem(event.target)) return;
|
if (!isJoplinChecklistItem(event.target)) return;
|
||||||
|
|
||||||
|
// We only process the click if it's within the checkbox itself (and not the label).
|
||||||
|
// That checkbox, based on
|
||||||
|
// the current styling is in the negative margin, so offsetX is negative when clicking
|
||||||
|
// on the checkbox itself, and positive when clicking on the label. This is strongly
|
||||||
|
// dependent on how the checkbox is styled, so if the style is changed, this might need
|
||||||
|
// to be updated too.
|
||||||
|
// For the styling, see:
|
||||||
|
// ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/checkbox.ts
|
||||||
|
//
|
||||||
|
// The previous solution was to use "pointer-event: none", which mostly work, however
|
||||||
|
// it means that links are no longer clickable when they are within the checkbox label.
|
||||||
|
if (event.offsetX >= 0) return;
|
||||||
|
|
||||||
editor.execCommand('ToggleJoplinChecklistItem', false, { element: event.target });
|
editor.execCommand('ToggleJoplinChecklistItem', false, { element: event.target });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +38,13 @@ pluginAssets[2] = function(theme:any) {
|
|||||||
mime: 'text/css',
|
mime: 'text/css',
|
||||||
text: `
|
text: `
|
||||||
/* https://stackoverflow.com/questions/7478336/only-detect-click-event-on-pseudo-element#comment39751366_7478344 */
|
/* https://stackoverflow.com/questions/7478336/only-detect-click-event-on-pseudo-element#comment39751366_7478344 */
|
||||||
|
/* Not doing this trick anymore. See Modules/TinyMCE/JoplinLists/src/main/ts/ui/Buttons.ts */
|
||||||
|
|
||||||
|
/*
|
||||||
ul.joplin-checklist li {
|
ul.joplin-checklist li {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
ul.joplin-checklist {
|
ul.joplin-checklist {
|
||||||
list-style:none;
|
list-style:none;
|
||||||
|
Reference in New Issue
Block a user