mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Merge branch 'master' of https://github.com/BoostIO/Boostnote into migrate-to-jest
This commit is contained in:
@@ -130,6 +130,81 @@ code {
|
||||
text-align: left;
|
||||
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 && 'display: block !important;'}
|
||||
font-family: '${codeBlockFontFamily.join("','")}';
|
||||
|
||||
@@ -16,6 +16,22 @@ const DEFAULT_MARKDOWN_LINT_CONFIG = `{
|
||||
"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 = {
|
||||
zoom: 1,
|
||||
isSideNavFolded: false,
|
||||
@@ -83,7 +99,7 @@ export const DEFAULT_CONFIG = {
|
||||
enableSmartPaste: false,
|
||||
enableMarkdownLint: false,
|
||||
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG,
|
||||
prettierConfig: ` {
|
||||
prettierConfig: `{
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 2,
|
||||
"semi": false,
|
||||
@@ -108,8 +124,7 @@ export const DEFAULT_CONFIG = {
|
||||
breaks: true,
|
||||
smartArrows: false,
|
||||
allowCustomCSS: false,
|
||||
|
||||
customCSS: '/* Drop Your Custom CSS Code Here */',
|
||||
customCSS: DEFAULT_CSS_CONFIG,
|
||||
sanitize: 'STRICT', // 'STRICT', 'ALLOW_STYLES', 'NONE'
|
||||
mermaidHTMLLabel: false,
|
||||
lineThroughCheckbox: true
|
||||
|
||||
@@ -713,24 +713,30 @@ function replaceNoteKeyWithNewNoteKey(noteContent, oldNoteKey, newNoteKey) {
|
||||
*/
|
||||
function removeStorageAndNoteReferences(input, noteKey) {
|
||||
return input.replace(
|
||||
new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|])', 'g'),
|
||||
new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|\\))', 'g'),
|
||||
function(match) {
|
||||
const temp = match
|
||||
.replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.sep)
|
||||
.replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.sep)
|
||||
.replace(new RegExp(escapeStringRegexp(path.win32.sep), 'g'), path.sep)
|
||||
.replace(new RegExp(escapeStringRegexp(path.posix.sep), 'g'), path.sep)
|
||||
return temp.replace(
|
||||
new RegExp(
|
||||
STORAGE_FOLDER_PLACEHOLDER +
|
||||
'(' +
|
||||
escapeStringRegexp(path.sep) +
|
||||
noteKey +
|
||||
')?',
|
||||
'g'
|
||||
),
|
||||
DESTINATION_FOLDER
|
||||
)
|
||||
return match
|
||||
.replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.posix.sep)
|
||||
.replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.posix.sep)
|
||||
.replace(
|
||||
new RegExp(escapeStringRegexp(path.win32.sep), 'g'),
|
||||
path.posix.sep
|
||||
)
|
||||
.replace(
|
||||
new RegExp(escapeStringRegexp(path.posix.sep), 'g'),
|
||||
path.posix.sep
|
||||
)
|
||||
.replace(
|
||||
new RegExp(
|
||||
STORAGE_FOLDER_PLACEHOLDER +
|
||||
'(' +
|
||||
escapeStringRegexp(path.sep) +
|
||||
noteKey +
|
||||
')?',
|
||||
'g'
|
||||
),
|
||||
DESTINATION_FOLDER
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -685,19 +685,19 @@ it('should remove the all ":storage" and noteKey references', function() {
|
||||
' <p data-line="2">\n' +
|
||||
' <img src="' +
|
||||
storageFolder +
|
||||
path.sep +
|
||||
path.posix.sep +
|
||||
'0.6r4zdgc22xp.png" alt="dummyImage.png" >\n' +
|
||||
' </p>\n' +
|
||||
' <p data-line="4">\n' +
|
||||
' <a href="' +
|
||||
storageFolder +
|
||||
path.sep +
|
||||
path.posix.sep +
|
||||
'0.q2i4iw0fyx.pdf">dummyPDF.pdf</a>\n' +
|
||||
' </p>\n' +
|
||||
' <p data-line="6">\n' +
|
||||
' <img src="' +
|
||||
storageFolder +
|
||||
path.sep +
|
||||
path.posix.sep +
|
||||
'd6c5ee92.jpg" alt="dummyImage2.jpg">\n' +
|
||||
' </p>\n' +
|
||||
' </body>\n' +
|
||||
@@ -713,29 +713,29 @@ it('should make sure that "removeStorageAndNoteReferences" works with markdown c
|
||||
const noteKey = 'noteKey'
|
||||
const testInput =
|
||||
'Test input' +
|
||||
' \n' +
|
||||
'[' +
|
||||
'image.jpg) \n' +
|
||||
'[pdf](' +
|
||||
systemUnderTest.STORAGE_FOLDER_PLACEHOLDER +
|
||||
path.posix.sep +
|
||||
noteKey +
|
||||
path.posix.sep +
|
||||
'pdf.pdf](pdf})'
|
||||
'pdf.pdf)'
|
||||
|
||||
const expectedOutput =
|
||||
'Test input' +
|
||||
' \n' +
|
||||
'[' +
|
||||
path.posix.sep +
|
||||
'image.jpg) \n' +
|
||||
'[pdf](' +
|
||||
systemUnderTest.DESTINATION_FOLDER +
|
||||
path.sep +
|
||||
'pdf.pdf](pdf})'
|
||||
path.posix.sep +
|
||||
'pdf.pdf)'
|
||||
const actual = systemUnderTest.removeStorageAndNoteReferences(
|
||||
testInput,
|
||||
noteKey
|
||||
|
||||
@@ -12,7 +12,7 @@ const originalDate = Date
|
||||
let context = {}
|
||||
|
||||
beforeAll(() => {
|
||||
const constantDate = new Date('2017-11-27T14:33:42Z')
|
||||
const constantDate = new Date('2017-11-27T14:33:42')
|
||||
global.Date = class extends Date {
|
||||
constructor() {
|
||||
super()
|
||||
|
||||
Reference in New Issue
Block a user