Skip to content

Commit

Permalink
Desktop, Mobile: Resolves laurent22#1832: Only support checkboxes tha…
Browse files Browse the repository at this point in the history
…t start with a dash
  • Loading branch information
laurent22 authored and scoroi committed Nov 10, 2019
1 parent b83f1cd commit 1430e2a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ReactNativeClient/lib/renderers/MdToHtml/rules/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion ReactNativeClient/lib/renderers/noteStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions ReactNativeClient/lib/services/rest/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,15 @@ 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;
}

const imageSize = imageSizesCollection[imageSizesIndexes[urlInfo.originalUrl]];
imageSizesIndexes[urlInfo.originalUrl]++;

if (imageSize && (imageSize.naturalWidth !== imageSize.width || imageSize.naturalHeight !== imageSize.height)) {
return '<img width="' + imageSize.width + '" height="' + imageSize.height + '" src="' + resourceUrl + '"/>';
} else {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"lint-staged": {
"*.{js,jsx}": [
"npm run linter"
"npm run linter",
"git add"
]
},
"repository": {
Expand Down

0 comments on commit 1430e2a

Please sign in to comment.