@tenjuu99/blog 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ export const post = async (req, res) => {
|
|
|
19
19
|
const json = JSON.parse(chunks.join())
|
|
20
20
|
const file = json.inputFileName ? json.inputFileName : json.selectDataFile
|
|
21
21
|
if (!file) {
|
|
22
|
-
res.writeHead(
|
|
22
|
+
res.writeHead(400, { 'content-type': 'application/json' })
|
|
23
23
|
res.end(JSON.stringify({
|
|
24
24
|
'message': 'ファイル名がありません'
|
|
25
25
|
}))
|
|
@@ -18,7 +18,7 @@ export const post = async (req, res) => {
|
|
|
18
18
|
const json = JSON.parse(chunks.join())
|
|
19
19
|
const filename = json.inputFileName ? json.inputFileName : json.selectDataFile
|
|
20
20
|
const pageData = makePageData(filename, json.content)
|
|
21
|
-
const rendered = await render(
|
|
21
|
+
const rendered = await render(pageData.template, pageData)
|
|
22
22
|
res.writeHead(200, { 'content-type': 'application/json' })
|
|
23
23
|
res.end(JSON.stringify({
|
|
24
24
|
'preview': rendered
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
height: 100%;
|
|
57
57
|
border: none;
|
|
58
58
|
border-radius: 0 5px 5px 0;
|
|
59
|
+
pointer-events: none;
|
|
59
60
|
}
|
|
60
61
|
@media screen and (max-width: 600px) {
|
|
61
62
|
main {
|
|
@@ -114,9 +115,16 @@
|
|
|
114
115
|
inputFileName.value = json.filename
|
|
115
116
|
inputFileName.setAttribute('disabled', true)
|
|
116
117
|
url.searchParams.set('md', select.value)
|
|
118
|
+
submit('/preview', form)
|
|
117
119
|
} else {
|
|
118
120
|
inputFileName.value = ""
|
|
119
121
|
inputFileName.removeAttribute('disabled')
|
|
122
|
+
textarea.value = ''
|
|
123
|
+
url.searchParams.set('md', "")
|
|
124
|
+
const iframe = preview.querySelector('iframe')
|
|
125
|
+
if (iframe) {
|
|
126
|
+
iframe.srcdoc = ''
|
|
127
|
+
}
|
|
120
128
|
}
|
|
121
129
|
history.pushState({}, "", url)
|
|
122
130
|
})
|
|
@@ -143,6 +151,7 @@
|
|
|
143
151
|
if (json.preview) {
|
|
144
152
|
const iframe = document.createElement('iframe')
|
|
145
153
|
iframe.setAttribute('srcdoc', json.preview)
|
|
154
|
+
iframe.setAttribute('sandbox', '')
|
|
146
155
|
const old = preview.querySelector('iframe')
|
|
147
156
|
if (!old) {
|
|
148
157
|
preview.appendChild(iframe)
|