1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 10:46:32 +00:00

Merge branch 'master' of https://github.com/BoostIO/Boostnote into migrate-to-jest

This commit is contained in:
ZeroX-DG
2020-04-17 21:49:38 +12:00
5 changed files with 130 additions and 34 deletions

View File

@@ -130,6 +130,81 @@ code {
text-align: left; text-align: left;
direction: ltr; direction: ltr;
} }
p code,
li code,
td code
{
padding: 2px;
border-width: 1px;
border-style: solid;
border-radius: 5px;
}
[data-theme="default"] p code,
[data-theme="default"] li code,
[data-theme="default"] td code
{
background-color: #F4F4F4;
border-color: #d9d9d9;
color: inherit;
}
[data-theme="white"] p code,
[data-theme="white"] li code,
[data-theme="white"] td code
{
background-color: #F4F4F4;
border-color: #d9d9d9;
color: inherit;
}
[data-theme="dark"] p code,
[data-theme="dark"] li code,
[data-theme="dark"] td code
{
background-color: #444444;
border-color: #555;
color: #FFFFFF;
}
[data-theme="dracula"] p code,
[data-theme="dracula"] li code,
[data-theme="dracula"] td code
{
background-color: #444444;
border-color: #555;
color: #FFFFFF;
}
[data-theme="monokai"] p code,
[data-theme="monokai"] li code,
[data-theme="monokai"] td code
{
background-color: #444444;
border-color: #555;
color: #FFFFFF;
}
[data-theme="nord"] p code,
[data-theme="nord"] li code,
[data-theme="nord"] td code
{
background-color: #444444;
border-color: #555;
color: #FFFFFF;
}
[data-theme="solarized-dark"] p code,
[data-theme="solarized-dark"] li code,
[data-theme="solarized-dark"] td code
{
background-color: #444444;
border-color: #555;
color: #FFFFFF;
}
[data-theme="vulcan"] p code,
[data-theme="vulcan"] li code,
[data-theme="vulcan"] td code
{
background-color: #444444;
border-color: #555;
color: #FFFFFF;
}
.lineNumber { .lineNumber {
${lineNumber && 'display: block !important;'} ${lineNumber && 'display: block !important;'}
font-family: '${codeBlockFontFamily.join("','")}'; font-family: '${codeBlockFontFamily.join("','")}';

View File

@@ -16,6 +16,22 @@ const DEFAULT_MARKDOWN_LINT_CONFIG = `{
"default": true "default": true
}` }`
const DEFAULT_CSS_CONFIG = `
/* Drop Your Custom CSS Code Here */
[data-theme="default"] p code,
[data-theme="default"] li code,
[data-theme="default"] td code
{
padding: 2px;
border-width: 1px;
border-style: solid;
border-radius: 5px;
background-color: #F4F4F4;
border-color: #d9d9d9;
color: #03C588;
}
`
export const DEFAULT_CONFIG = { export const DEFAULT_CONFIG = {
zoom: 1, zoom: 1,
isSideNavFolded: false, isSideNavFolded: false,
@@ -83,7 +99,7 @@ export const DEFAULT_CONFIG = {
enableSmartPaste: false, enableSmartPaste: false,
enableMarkdownLint: false, enableMarkdownLint: false,
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG, customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG,
prettierConfig: ` { prettierConfig: `{
"trailingComma": "es5", "trailingComma": "es5",
"tabWidth": 2, "tabWidth": 2,
"semi": false, "semi": false,
@@ -108,8 +124,7 @@ export const DEFAULT_CONFIG = {
breaks: true, breaks: true,
smartArrows: false, smartArrows: false,
allowCustomCSS: false, allowCustomCSS: false,
customCSS: DEFAULT_CSS_CONFIG,
customCSS: '/* Drop Your Custom CSS Code Here */',
sanitize: 'STRICT', // 'STRICT', 'ALLOW_STYLES', 'NONE' sanitize: 'STRICT', // 'STRICT', 'ALLOW_STYLES', 'NONE'
mermaidHTMLLabel: false, mermaidHTMLLabel: false,
lineThroughCheckbox: true lineThroughCheckbox: true

View File

@@ -713,24 +713,30 @@ function replaceNoteKeyWithNewNoteKey(noteContent, oldNoteKey, newNoteKey) {
*/ */
function removeStorageAndNoteReferences(input, noteKey) { function removeStorageAndNoteReferences(input, noteKey) {
return input.replace( return input.replace(
new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|])', 'g'), new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|\\))', 'g'),
function(match) { function(match) {
const temp = match return match
.replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.sep) .replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.posix.sep)
.replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.sep) .replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.posix.sep)
.replace(new RegExp(escapeStringRegexp(path.win32.sep), 'g'), path.sep) .replace(
.replace(new RegExp(escapeStringRegexp(path.posix.sep), 'g'), path.sep) new RegExp(escapeStringRegexp(path.win32.sep), 'g'),
return temp.replace( path.posix.sep
new RegExp( )
STORAGE_FOLDER_PLACEHOLDER + .replace(
'(' + new RegExp(escapeStringRegexp(path.posix.sep), 'g'),
escapeStringRegexp(path.sep) + path.posix.sep
noteKey + )
')?', .replace(
'g' new RegExp(
), STORAGE_FOLDER_PLACEHOLDER +
DESTINATION_FOLDER '(' +
) escapeStringRegexp(path.sep) +
noteKey +
')?',
'g'
),
DESTINATION_FOLDER
)
} }
) )
} }

View File

@@ -685,19 +685,19 @@ it('should remove the all ":storage" and noteKey references', function() {
' <p data-line="2">\n' + ' <p data-line="2">\n' +
' <img src="' + ' <img src="' +
storageFolder + storageFolder +
path.sep + path.posix.sep +
'0.6r4zdgc22xp.png" alt="dummyImage.png" >\n' + '0.6r4zdgc22xp.png" alt="dummyImage.png" >\n' +
' </p>\n' + ' </p>\n' +
' <p data-line="4">\n' + ' <p data-line="4">\n' +
' <a href="' + ' <a href="' +
storageFolder + storageFolder +
path.sep + path.posix.sep +
'0.q2i4iw0fyx.pdf">dummyPDF.pdf</a>\n' + '0.q2i4iw0fyx.pdf">dummyPDF.pdf</a>\n' +
' </p>\n' + ' </p>\n' +
' <p data-line="6">\n' + ' <p data-line="6">\n' +
' <img src="' + ' <img src="' +
storageFolder + storageFolder +
path.sep + path.posix.sep +
'd6c5ee92.jpg" alt="dummyImage2.jpg">\n' + 'd6c5ee92.jpg" alt="dummyImage2.jpg">\n' +
' </p>\n' + ' </p>\n' +
' </body>\n' + ' </body>\n' +
@@ -713,29 +713,29 @@ it('should make sure that "removeStorageAndNoteReferences" works with markdown c
const noteKey = 'noteKey' const noteKey = 'noteKey'
const testInput = const testInput =
'Test input' + 'Test input' +
'![' + '![imageName](' +
systemUnderTest.STORAGE_FOLDER_PLACEHOLDER + systemUnderTest.STORAGE_FOLDER_PLACEHOLDER +
path.win32.sep + path.win32.sep +
noteKey + noteKey +
path.win32.sep + path.win32.sep +
'image.jpg](imageName}) \n' + 'image.jpg) \n' +
'[' + '[pdf](' +
systemUnderTest.STORAGE_FOLDER_PLACEHOLDER + systemUnderTest.STORAGE_FOLDER_PLACEHOLDER +
path.posix.sep + path.posix.sep +
noteKey + noteKey +
path.posix.sep + path.posix.sep +
'pdf.pdf](pdf})' 'pdf.pdf)'
const expectedOutput = const expectedOutput =
'Test input' + 'Test input' +
'![' + '![imageName](' +
systemUnderTest.DESTINATION_FOLDER + systemUnderTest.DESTINATION_FOLDER +
path.sep + path.posix.sep +
'image.jpg](imageName}) \n' + 'image.jpg) \n' +
'[' + '[pdf](' +
systemUnderTest.DESTINATION_FOLDER + systemUnderTest.DESTINATION_FOLDER +
path.sep + path.posix.sep +
'pdf.pdf](pdf})' 'pdf.pdf)'
const actual = systemUnderTest.removeStorageAndNoteReferences( const actual = systemUnderTest.removeStorageAndNoteReferences(
testInput, testInput,
noteKey noteKey

View File

@@ -12,7 +12,7 @@ const originalDate = Date
let context = {} let context = {}
beforeAll(() => { beforeAll(() => {
const constantDate = new Date('2017-11-27T14:33:42Z') const constantDate = new Date('2017-11-27T14:33:42')
global.Date = class extends Date { global.Date = class extends Date {
constructor() { constructor() {
super() super()