Skip to content

Commit 8ca3ba2

Browse files
committed
Merge branch 'master' of https://github.com/BoostIO/Boostnote into migrate-to-jest
2 parents 58ae641 + b56e0b9 commit 8ca3ba2

File tree

5 files changed

+130
-34
lines changed

5 files changed

+130
-34
lines changed

browser/components/MarkdownPreview.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,81 @@ code {
130130
text-align: left;
131131
direction: ltr;
132132
}
133+
134+
p code,
135+
li code,
136+
td code
137+
{
138+
padding: 2px;
139+
border-width: 1px;
140+
border-style: solid;
141+
border-radius: 5px;
142+
}
143+
[data-theme="default"] p code,
144+
[data-theme="default"] li code,
145+
[data-theme="default"] td code
146+
{
147+
background-color: #F4F4F4;
148+
border-color: #d9d9d9;
149+
color: inherit;
150+
}
151+
[data-theme="white"] p code,
152+
[data-theme="white"] li code,
153+
[data-theme="white"] td code
154+
{
155+
background-color: #F4F4F4;
156+
border-color: #d9d9d9;
157+
color: inherit;
158+
}
159+
[data-theme="dark"] p code,
160+
[data-theme="dark"] li code,
161+
[data-theme="dark"] td code
162+
{
163+
background-color: #444444;
164+
border-color: #555;
165+
color: #FFFFFF;
166+
}
167+
[data-theme="dracula"] p code,
168+
[data-theme="dracula"] li code,
169+
[data-theme="dracula"] td code
170+
{
171+
background-color: #444444;
172+
border-color: #555;
173+
color: #FFFFFF;
174+
}
175+
[data-theme="monokai"] p code,
176+
[data-theme="monokai"] li code,
177+
[data-theme="monokai"] td code
178+
{
179+
background-color: #444444;
180+
border-color: #555;
181+
color: #FFFFFF;
182+
}
183+
[data-theme="nord"] p code,
184+
[data-theme="nord"] li code,
185+
[data-theme="nord"] td code
186+
{
187+
background-color: #444444;
188+
border-color: #555;
189+
color: #FFFFFF;
190+
}
191+
[data-theme="solarized-dark"] p code,
192+
[data-theme="solarized-dark"] li code,
193+
[data-theme="solarized-dark"] td code
194+
{
195+
background-color: #444444;
196+
border-color: #555;
197+
color: #FFFFFF;
198+
}
199+
[data-theme="vulcan"] p code,
200+
[data-theme="vulcan"] li code,
201+
[data-theme="vulcan"] td code
202+
{
203+
background-color: #444444;
204+
border-color: #555;
205+
color: #FFFFFF;
206+
}
207+
133208
.lineNumber {
134209
${lineNumber && 'display: block !important;'}
135210
font-family: '${codeBlockFontFamily.join("','")}';

browser/main/lib/ConfigManager.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ const DEFAULT_MARKDOWN_LINT_CONFIG = `{
1616
"default": true
1717
}`
1818

19+
const DEFAULT_CSS_CONFIG = `
20+
/* Drop Your Custom CSS Code Here */
21+
[data-theme="default"] p code,
22+
[data-theme="default"] li code,
23+
[data-theme="default"] td code
24+
{
25+
padding: 2px;
26+
border-width: 1px;
27+
border-style: solid;
28+
border-radius: 5px;
29+
background-color: #F4F4F4;
30+
border-color: #d9d9d9;
31+
color: #03C588;
32+
}
33+
`
34+
1935
export const DEFAULT_CONFIG = {
2036
zoom: 1,
2137
isSideNavFolded: false,
@@ -83,7 +99,7 @@ export const DEFAULT_CONFIG = {
8399
enableSmartPaste: false,
84100
enableMarkdownLint: false,
85101
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG,
86-
prettierConfig: ` {
102+
prettierConfig: `{
87103
"trailingComma": "es5",
88104
"tabWidth": 2,
89105
"semi": false,
@@ -108,8 +124,7 @@ export const DEFAULT_CONFIG = {
108124
breaks: true,
109125
smartArrows: false,
110126
allowCustomCSS: false,
111-
112-
customCSS: '/* Drop Your Custom CSS Code Here */',
127+
customCSS: DEFAULT_CSS_CONFIG,
113128
sanitize: 'STRICT', // 'STRICT', 'ALLOW_STYLES', 'NONE'
114129
mermaidHTMLLabel: false,
115130
lineThroughCheckbox: true

browser/main/lib/dataApi/attachmentManagement.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -713,24 +713,30 @@ function replaceNoteKeyWithNewNoteKey(noteContent, oldNoteKey, newNoteKey) {
713713
*/
714714
function removeStorageAndNoteReferences(input, noteKey) {
715715
return input.replace(
716-
new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|])', 'g'),
716+
new RegExp('/?' + STORAGE_FOLDER_PLACEHOLDER + '.*?("|\\))', 'g'),
717717
function(match) {
718-
const temp = match
719-
.replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.sep)
720-
.replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.sep)
721-
.replace(new RegExp(escapeStringRegexp(path.win32.sep), 'g'), path.sep)
722-
.replace(new RegExp(escapeStringRegexp(path.posix.sep), 'g'), path.sep)
723-
return temp.replace(
724-
new RegExp(
725-
STORAGE_FOLDER_PLACEHOLDER +
726-
'(' +
727-
escapeStringRegexp(path.sep) +
728-
noteKey +
729-
')?',
730-
'g'
731-
),
732-
DESTINATION_FOLDER
733-
)
718+
return match
719+
.replace(new RegExp(mdurl.encode(path.win32.sep), 'g'), path.posix.sep)
720+
.replace(new RegExp(mdurl.encode(path.posix.sep), 'g'), path.posix.sep)
721+
.replace(
722+
new RegExp(escapeStringRegexp(path.win32.sep), 'g'),
723+
path.posix.sep
724+
)
725+
.replace(
726+
new RegExp(escapeStringRegexp(path.posix.sep), 'g'),
727+
path.posix.sep
728+
)
729+
.replace(
730+
new RegExp(
731+
STORAGE_FOLDER_PLACEHOLDER +
732+
'(' +
733+
escapeStringRegexp(path.sep) +
734+
noteKey +
735+
')?',
736+
'g'
737+
),
738+
DESTINATION_FOLDER
739+
)
734740
}
735741
)
736742
}

tests/dataApi/attachmentManagement.test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -685,19 +685,19 @@ it('should remove the all ":storage" and noteKey references', function() {
685685
' <p data-line="2">\n' +
686686
' <img src="' +
687687
storageFolder +
688-
path.sep +
688+
path.posix.sep +
689689
'0.6r4zdgc22xp.png" alt="dummyImage.png" >\n' +
690690
' </p>\n' +
691691
' <p data-line="4">\n' +
692692
' <a href="' +
693693
storageFolder +
694-
path.sep +
694+
path.posix.sep +
695695
'0.q2i4iw0fyx.pdf">dummyPDF.pdf</a>\n' +
696696
' </p>\n' +
697697
' <p data-line="6">\n' +
698698
' <img src="' +
699699
storageFolder +
700-
path.sep +
700+
path.posix.sep +
701701
'd6c5ee92.jpg" alt="dummyImage2.jpg">\n' +
702702
' </p>\n' +
703703
' </body>\n' +
@@ -713,29 +713,29 @@ it('should make sure that "removeStorageAndNoteReferences" works with markdown c
713713
const noteKey = 'noteKey'
714714
const testInput =
715715
'Test input' +
716-
'![' +
716+
'![imageName](' +
717717
systemUnderTest.STORAGE_FOLDER_PLACEHOLDER +
718718
path.win32.sep +
719719
noteKey +
720720
path.win32.sep +
721-
'image.jpg](imageName}) \n' +
722-
'[' +
721+
'image.jpg) \n' +
722+
'[pdf](' +
723723
systemUnderTest.STORAGE_FOLDER_PLACEHOLDER +
724724
path.posix.sep +
725725
noteKey +
726726
path.posix.sep +
727-
'pdf.pdf](pdf})'
727+
'pdf.pdf)'
728728

729729
const expectedOutput =
730730
'Test input' +
731-
'![' +
731+
'![imageName](' +
732732
systemUnderTest.DESTINATION_FOLDER +
733-
path.sep +
734-
'image.jpg](imageName}) \n' +
735-
'[' +
733+
path.posix.sep +
734+
'image.jpg) \n' +
735+
'[pdf](' +
736736
systemUnderTest.DESTINATION_FOLDER +
737-
path.sep +
738-
'pdf.pdf](pdf})'
737+
path.posix.sep +
738+
'pdf.pdf)'
739739
const actual = systemUnderTest.removeStorageAndNoteReferences(
740740
testInput,
741741
noteKey

tests/lib/themeManager.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const originalDate = Date
1212
let context = {}
1313

1414
beforeAll(() => {
15-
const constantDate = new Date('2017-11-27T14:33:42Z')
15+
const constantDate = new Date('2017-11-27T14:33:42')
1616
global.Date = class extends Date {
1717
constructor() {
1818
super()

0 commit comments

Comments
 (0)