mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 14:09:34 +01:00
Merge branch 'master' into beta
This commit is contained in:
@@ -126,6 +126,16 @@ But this post was supposed to be about the "Secrets" of Typescript Generics, rig
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`convert HTML to markdown with leadingWhitespaces > html-to-md-leadingWhitespaces.md 1`] = `
|
||||
"two spaces
|
||||
|
||||
four spaces
|
||||
two spaces
|
||||
four spaces
|
||||
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`convert HTML to markdown with outlinelists > html-to-md-outlinelists.md 1`] = `
|
||||
"Testing outline list:
|
||||
|
||||
@@ -389,6 +399,14 @@ right? Well, let's get into that.
|
||||
4. TYPE INFERENCE USING INTERFACE PROPERTIES"
|
||||
`;
|
||||
|
||||
exports[`convert HTML to text with leadingWhitespaces > html-to-txt-leadingWhitespaces.txt 1`] = `
|
||||
" two spaces
|
||||
|
||||
four spaces
|
||||
two spaces
|
||||
four spaces"
|
||||
`;
|
||||
|
||||
exports[`convert HTML to text with outlinelists > html-to-txt-outlinelists.txt 1`] = `
|
||||
"Testing outline list:
|
||||
* My outline list
|
||||
|
||||
@@ -65,7 +65,8 @@ const HTMLS = {
|
||||
tasklists: `<p>Hello</p><ul data-collapsed="false" class="checklist"><li class="checked checklist--item"><p>Task item 1</p></li><li class="checked checklist--item"><p>Task item 2</p></li><li class="checked checklist--item"><p>Task item 3</p></li><li class="checklist--item"><p>Task item 4</p><ul data-collapsed="false" class="checklist"><li class="checklist--item"><p>Sub task item 1</p></li><li class="checklist--item"><p>Sub task item 2</p></li></ul></li><li class="checklist--item"><p>Task Item 5</p></li></ul><p>Nene</p><ul><li><p>dasvsadv</p></li><li><p>adsva\`sd</p></li><li><p>vasd</p></li><li><p>vsadvdsa</p></li></ul>`,
|
||||
outlinelists: `<p >Testing outline list:</p><ul data-collapsed="false" data-type="outlineList"><li data-type="outlineListItem"><p >My outline list</p></li><li data-type="outlineListItem"><p >works</p></li><li data-type="outlineListItem"><p >but sometimes</p><ul data-collapsed="false" data-type="outlineList"><li data-type="outlineListItem"><p >It doesn't</p></li><li data-type="outlineListItem"><p >what do I do?</p></li><li data-type="outlineListItem"><p >I need to do something!</p></li></ul></li><li data-type="outlineListItem"><p >Makes no sense!</p></li><li data-type="outlineListItem"><p >Yes it doesn't!</p></li></ul>`,
|
||||
codeblock2: `<pre>hello<br></pre>`,
|
||||
singleSpacedParagraphs: `<p data-spacing="single">hello world</p><p data-spacing="single">hello world 2</p>`
|
||||
singleSpacedParagraphs: `<p data-spacing="single">hello world</p><p data-spacing="single">hello world 2</p>`,
|
||||
leadingWhitespaces: `<p data-spacing="double"> two spaces</p><p data-spacing="double"> four spaces</p><p data-spacing="single"> two spaces</p><p data-spacing="single"> four spaces</p>`
|
||||
};
|
||||
|
||||
for (const html in HTMLS) {
|
||||
|
||||
@@ -413,6 +413,22 @@ function convertHtmlToTxt(html: string, wrap = true) {
|
||||
builder.openBlock({
|
||||
leadingLineBreaks: dataSpacing == "single" ? 1 : 2
|
||||
});
|
||||
|
||||
// convert leading whitespace to NO-BREAK SPACE
|
||||
if (elem.children && elem.children.length > 0) {
|
||||
const firstChild = elem.children[0];
|
||||
if (firstChild.type === "text" && firstChild.data) {
|
||||
firstChild.data = firstChild.data.replace(
|
||||
/^([ \t]+)/,
|
||||
(match) => {
|
||||
return match
|
||||
.replace(/ /g, "\u00A0")
|
||||
.replace(/\t/g, "\u00A0\u00A0\u00A0\u00A0");
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
walk(elem.children, builder);
|
||||
builder.closeBlock({
|
||||
trailingLineBreaks: 1
|
||||
|
||||
@@ -609,10 +609,10 @@ export class FilteredSelector<T extends Item> {
|
||||
sanitizeSortOptions(this.type, options);
|
||||
|
||||
const sortBy: Set<SortOptions["sortBy"]> = new Set();
|
||||
sortBy.add(options.sortBy);
|
||||
if (options.groupBy === "abc") sortBy.add("title");
|
||||
else if (options.sortBy === "title" && options.groupBy !== "none")
|
||||
sortBy.add("dateCreated");
|
||||
sortBy.add(options.sortBy);
|
||||
|
||||
return <T>(
|
||||
qb: SelectQueryBuilder<DatabaseSchema, keyof DatabaseSchema, T>
|
||||
|
||||
@@ -22,5 +22,5 @@ import { TemplateData } from "./index.js";
|
||||
export function buildText(data: TemplateData) {
|
||||
return `${data.title}
|
||||
|
||||
${data.content}`;
|
||||
${data.content}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user