From 5a9b3b6c7cd9ab22941b485541ea663ef8ff771b Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 7 Sep 2019 11:18:07 +0100 Subject: [PATCH] Desktop, Mobile: Resolves #1832: Only support checkboxes that start with a dash --- ReactNativeClient/lib/renderers/MdToHtml/rules/checkbox.js | 3 ++- ReactNativeClient/lib/renderers/noteStyle.js | 6 +++++- ReactNativeClient/lib/services/rest/Api.js | 4 ++-- package.json | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ReactNativeClient/lib/renderers/MdToHtml/rules/checkbox.js b/ReactNativeClient/lib/renderers/MdToHtml/rules/checkbox.js index 71d134ddcc..7f2c6a34a6 100644 --- a/ReactNativeClient/lib/renderers/MdToHtml/rules/checkbox.js +++ b/ReactNativeClient/lib/renderers/MdToHtml/rules/checkbox.js @@ -83,7 +83,8 @@ function installRule(markdownIt, mdOptions, ruleOptions, context) { continue; } - if (currentListItem && !processedFirstInline && token.type === 'inline') { + // Note that we only support list items that start with "-" (not with "*") + if (currentListItem && currentListItem.markup === '-' && !processedFirstInline && token.type === 'inline') { processedFirstInline = true; const firstChild = token.children && token.children.length ? token.children[0] : null; if (!firstChild) continue; diff --git a/ReactNativeClient/lib/renderers/noteStyle.js b/ReactNativeClient/lib/renderers/noteStyle.js index 515c348261..4fc9d78a11 100644 --- a/ReactNativeClient/lib/renderers/noteStyle.js +++ b/ReactNativeClient/lib/renderers/noteStyle.js @@ -237,7 +237,11 @@ module.exports = function(style, options) { align-items: center; } - .checkbox-label-checked { + .md-checkbox input[type=checkbox]:checked { + opacity: 0.7; + } + + .md-checkbox .checkbox-label-checked { opacity: 0.5; } diff --git a/ReactNativeClient/lib/services/rest/Api.js b/ReactNativeClient/lib/services/rest/Api.js index d4cd3d8520..2c7f597fa1 100644 --- a/ReactNativeClient/lib/services/rest/Api.js +++ b/ReactNativeClient/lib/services/rest/Api.js @@ -658,7 +658,7 @@ class Api { if (!imageSizesCollection) { // In some cases, we won't find the image size information for that particular URL. Normally - // it will only happen when using the "Clip simplified page" feature, which can modify the + // it will only happen when using the "Clip simplified page" feature, which can modify the // image URLs (for example it will select a smaller size resolution). In that case, it's // fine to return the image as-is because it has already good dimensions. return before + resourceUrl + after; @@ -666,7 +666,7 @@ class Api { const imageSize = imageSizesCollection[imageSizesIndexes[urlInfo.originalUrl]]; imageSizesIndexes[urlInfo.originalUrl]++; - + if (imageSize && (imageSize.naturalWidth !== imageSize.width || imageSize.naturalHeight !== imageSize.height)) { return ''; } else { diff --git a/package.json b/package.json index 9a9f4a59c4..33fe0483ed 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ }, "lint-staged": { "*.{js,jsx}": [ - "npm run linter" + "npm run linter", + "git add" ] }, "repository": {