1
0
mirror of https://github.com/laurent22/joplin.git synced 2026-01-02 00:08:04 +02:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Laurent Cozic
6ff44f53da minor fixes 2021-01-03 13:18:36 +00:00
Laurent Cozic
3c8f774e85 Plugins: Updated types 2021-01-03 12:59:16 +00:00
Laurent Cozic
d49439689e update generator 2021-01-03 12:58:00 +00:00
Laurent Cozic
ef3a102741 content script support 2021-01-03 00:51:36 +00:00
5 changed files with 10 additions and 12 deletions

View File

@@ -82,7 +82,9 @@ export default function useSource(noteBody: string, noteMarkupLanguage: number,
resources: noteResources,
codeTheme: theme.codeThemeCss,
postMessageSyntax: 'window.joplinPostMessage_',
enableLongPress: shim.mobilePlatform() === 'android', // On iOS, there's already a built-on open/share menu
// Disabled for now as it causes issues when zooming in or out
// https://github.com/laurent22/joplin/pull/3939#issuecomment-734260166
enableLongPress: false, // shim.mobilePlatform() === 'android', // On iOS, there's already a built-on open/share menu
};
// Whenever a resource state changes, for example when it goes from "not downloaded" to "downloaded", the "noteResources"

View File

@@ -1,6 +1,6 @@
{
"name": "generator-joplin",
"version": "1.6.2",
"version": "1.6.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,11 +1,11 @@
{
"name": "generator-joplin",
"version": "1.6.2",
"version": "1.6.1",
"description": "Scaffolds out a new Joplin plugin",
"homepage": "https://github.com/laurent22/joplin/tree/dev/packages/generator-joplin",
"homepage": "https://joplinapp.org",
"author": {
"name": "Laurent Cozic",
"url": "https://github.com/laurent22/joplin/tree/dev/packages/generator-joplin"
"url": "https://joplinapp.org"
},
"files": [
"generators"
@@ -26,4 +26,4 @@
"repository": "https://github.com/laurent22/generator-joplin",
"license": "MIT",
"private": true
}
}

View File

@@ -91,9 +91,7 @@ export default function(href: string, options: Options = null): LinkReplacementR
if (options.enableLongPress && !!resourceId) {
const onClick = `${options.postMessageSyntax}(${JSON.stringify(href)})`;
const onLongClick = `${options.postMessageSyntax}("longclick:${resourceId}")`;
// if t is set when ontouchstart is called it means the user has already touched the screen once and this is the 2nd touch
// in this case we assume the user is trying to zoom and we don't want to show the menu
const touchStart = `if (typeof(t) !== "undefined" && !!t) { clearTimeout(t); t = null; } else { t = setTimeout(() => { t = null; ${onLongClick}; }, ${utils.longPressDelay}); }`;
const touchStart = `t=setTimeout(()=>{t=null; ${onLongClick};}, ${utils.longPressDelay});`;
const cancel = 'if (!!t) {clearTimeout(t); t=null;';
const touchEnd = `${cancel} ${onClick};}`;
js = `ontouchstart='${touchStart}' ontouchend='${touchEnd}' ontouchcancel='${cancel} ontouchmove="${cancel}'`;

View File

@@ -22,9 +22,7 @@ function plugin(markdownIt: any, ruleOptions: RuleOptions) {
const id = r['data-resource-id'];
const longPressHandler = `${ruleOptions.postMessageSyntax}('longclick:${id}')`;
// if t is set when ontouchstart is called it means the user has already touched the screen once and this is the 2nd touch
// in this case we assume the user is trying to zoom and we don't want to show the menu
const touchStart = `if (typeof(t) !== 'undefined' && !!t) { clearTimeout(t); t = null; } else { t = setTimeout(() => { t = null; ${longPressHandler}; }, ${utils.longPressDelay}); }`;
const touchStart = `t=setTimeout(()=>{t=null; ${longPressHandler};}, ${utils.longPressDelay});`;
const cancel = 'if (!!t) clearTimeout(t); t=null';
js = ` ontouchstart="${touchStart}" ontouchend="${cancel}" ontouchcancel="${cancel}" ontouchmove="${cancel}"`;