Update app/templates/editor.html
Browse files- app/templates/editor.html +211 -211
app/templates/editor.html
CHANGED
|
@@ -1,212 +1,212 @@
|
|
| 1 |
-
{% extends "base.html" %}
|
| 2 |
-
|
| 3 |
-
{% block title %}{% if article %}编辑文章{% else %}新建文章{% endif %} -
|
| 4 |
-
|
| 5 |
-
{% block content %}
|
| 6 |
-
<div class="editor-container" style="
|
| 7 |
-
max-width: 1400px;
|
| 8 |
-
margin: 0 auto;
|
| 9 |
-
display: flex;
|
| 10 |
-
flex-direction: column;
|
| 11 |
-
gap: 1rem;
|
| 12 |
-
height: calc(100vh - 8rem);
|
| 13 |
-
padding: 0 1rem;
|
| 14 |
-
">
|
| 15 |
-
<!-- 标题区域 -->
|
| 16 |
-
<div class="editor-header" style="
|
| 17 |
-
background: white;
|
| 18 |
-
border-radius: 8px;
|
| 19 |
-
padding: 1.25rem;
|
| 20 |
-
border: 1px solid #B3CFEF;
|
| 21 |
-
">
|
| 22 |
-
<input type="text" id="titleInput" placeholder="请输入文章标题..." value="{{ article.title if article else '' }}" style="
|
| 23 |
-
width: 100%;
|
| 24 |
-
font-size: 1.5rem;
|
| 25 |
-
border: none;
|
| 26 |
-
outline: none;
|
| 27 |
-
color: #2C3E50;
|
| 28 |
-
">
|
| 29 |
-
</div>
|
| 30 |
-
|
| 31 |
-
<!-- 工具栏 -->
|
| 32 |
-
<div class="editor-toolbar" style="
|
| 33 |
-
background: white;
|
| 34 |
-
border-radius: 8px;
|
| 35 |
-
padding: 0.5rem;
|
| 36 |
-
display: flex;
|
| 37 |
-
gap: 0.25rem;
|
| 38 |
-
flex-wrap: wrap;
|
| 39 |
-
border: 1px solid #B3CFEF;
|
| 40 |
-
"></div>
|
| 41 |
-
|
| 42 |
-
<!-- 编辑器主体 -->
|
| 43 |
-
<div class="editor-main" style="
|
| 44 |
-
display: grid;
|
| 45 |
-
grid-template-columns: 1fr 1fr;
|
| 46 |
-
gap: 1rem;
|
| 47 |
-
flex: 1;
|
| 48 |
-
min-height: 0;
|
| 49 |
-
">
|
| 50 |
-
<!-- 编辑区域 -->
|
| 51 |
-
<textarea id="contentInput" placeholder="开始写作..." style="
|
| 52 |
-
background: white;
|
| 53 |
-
border-radius: 8px;
|
| 54 |
-
padding: 1.25rem;
|
| 55 |
-
border: 1px solid #B3CFEF;
|
| 56 |
-
font-family: 'Monaco', 'Consolas', monospace;
|
| 57 |
-
font-size: 0.9375rem;
|
| 58 |
-
line-height: 1.6;
|
| 59 |
-
color: #2C3E50;
|
| 60 |
-
resize: none;
|
| 61 |
-
outline: none;
|
| 62 |
-
">{{ article.content if article else '' }}</textarea>
|
| 63 |
-
|
| 64 |
-
<!-- 预览区域 -->
|
| 65 |
-
<div id="preview" class="markdown-preview" style="
|
| 66 |
-
background: white;
|
| 67 |
-
border-radius: 8px;
|
| 68 |
-
padding: 1.25rem;
|
| 69 |
-
border: 1px solid #B3CFEF;
|
| 70 |
-
overflow-y: auto;
|
| 71 |
-
color: #2C3E50;
|
| 72 |
-
"></div>
|
| 73 |
-
</div>
|
| 74 |
-
|
| 75 |
-
<!-- 底部工具栏 -->
|
| 76 |
-
<div class="editor-footer" style="
|
| 77 |
-
background: white;
|
| 78 |
-
border-radius: 8px;
|
| 79 |
-
padding: 0.75rem 1.25rem;
|
| 80 |
-
display: flex;
|
| 81 |
-
justify-content: space-between;
|
| 82 |
-
align-items: center;
|
| 83 |
-
border: 1px solid #B3CFEF;
|
| 84 |
-
">
|
| 85 |
-
<div class="word-count" style="
|
| 86 |
-
color: #6391C5;
|
| 87 |
-
font-size: 0.875rem;
|
| 88 |
-
"></div>
|
| 89 |
-
|
| 90 |
-
<button class="save-button" style="
|
| 91 |
-
padding: 0.5rem 1rem;
|
| 92 |
-
background: #6391C5;
|
| 93 |
-
color: white;
|
| 94 |
-
border: none;
|
| 95 |
-
border-radius: 4px;
|
| 96 |
-
font-size: 0.875rem;
|
| 97 |
-
cursor: pointer;
|
| 98 |
-
transition: background-color 0.2s;
|
| 99 |
-
display: flex;
|
| 100 |
-
align-items: center;
|
| 101 |
-
gap: 0.5rem;
|
| 102 |
-
">
|
| 103 |
-
<i class="fas fa-save" style="font-size: 0.875rem;"></i>
|
| 104 |
-
保存文章
|
| 105 |
-
</button>
|
| 106 |
-
</div>
|
| 107 |
-
</div>
|
| 108 |
-
|
| 109 |
-
<!-- 图片上传输入框 -->
|
| 110 |
-
<input type="file" id="imageInput" style="display: none" accept="image/*">
|
| 111 |
-
|
| 112 |
-
<style>
|
| 113 |
-
/* 工具栏按钮基础样式 */
|
| 114 |
-
.toolbar-button {
|
| 115 |
-
width: 32px;
|
| 116 |
-
height: 32px;
|
| 117 |
-
display: flex;
|
| 118 |
-
align-items: center;
|
| 119 |
-
justify-content: center;
|
| 120 |
-
border: 1px solid transparent;
|
| 121 |
-
border-radius: 4px;
|
| 122 |
-
color: #6391C5;
|
| 123 |
-
background: none;
|
| 124 |
-
cursor: pointer;
|
| 125 |
-
transition: all 0.2s;
|
| 126 |
-
font-size: 0.9375rem;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
.toolbar-button:hover {
|
| 130 |
-
background: #f8fafc;
|
| 131 |
-
border-color: #B3CFEF;
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
/* 预览区域样式优化 */
|
| 135 |
-
.markdown-preview h1,
|
| 136 |
-
.markdown-preview h2,
|
| 137 |
-
.markdown-preview h3 {
|
| 138 |
-
margin-top: 1.5em;
|
| 139 |
-
margin-bottom: 1em;
|
| 140 |
-
color: #2C3E50;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
.markdown-preview code {
|
| 144 |
-
background: #f8fafc;
|
| 145 |
-
padding: 0.2em 0.4em;
|
| 146 |
-
border-radius: 4px;
|
| 147 |
-
font-size: 0.9em;
|
| 148 |
-
color: #6391C5;
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
.markdown-preview pre {
|
| 152 |
-
background: #f8fafc;
|
| 153 |
-
padding: 1rem;
|
| 154 |
-
border-radius: 4px;
|
| 155 |
-
border: 1px solid #B3CFEF;
|
| 156 |
-
overflow-x: auto;
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
.markdown-preview pre code {
|
| 160 |
-
background: none;
|
| 161 |
-
padding: 0;
|
| 162 |
-
border-radius: 0;
|
| 163 |
-
}
|
| 164 |
-
|
| 165 |
-
.markdown-preview blockquote {
|
| 166 |
-
border-left: 4px solid #B3CFEF;
|
| 167 |
-
margin: 1em 0;
|
| 168 |
-
padding-left: 1em;
|
| 169 |
-
color: #64748b;
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
.markdown-preview img {
|
| 173 |
-
max-width: 100%;
|
| 174 |
-
border-radius: 4px;
|
| 175 |
-
}
|
| 176 |
-
</style>
|
| 177 |
-
|
| 178 |
-
<script>
|
| 179 |
-
// 编辑区域焦点效果
|
| 180 |
-
document.getElementById('contentInput').addEventListener('focus', function() {
|
| 181 |
-
this.style.borderColor = '#6391C5';
|
| 182 |
-
});
|
| 183 |
-
|
| 184 |
-
document.getElementById('contentInput').addEventListener('blur', function() {
|
| 185 |
-
this.style.borderColor = '#B3CFEF';
|
| 186 |
-
});
|
| 187 |
-
|
| 188 |
-
// 标题输入框焦点效果
|
| 189 |
-
document.getElementById('titleInput').addEventListener('focus', function() {
|
| 190 |
-
this.style.borderColor = '#6391C5';
|
| 191 |
-
});
|
| 192 |
-
|
| 193 |
-
document.getElementById('titleInput').addEventListener('blur', function() {
|
| 194 |
-
this.style.borderColor = '#B3CFEF';
|
| 195 |
-
});
|
| 196 |
-
|
| 197 |
-
// 保存按钮悬停效果
|
| 198 |
-
document.querySelector('.save-button').addEventListener('mouseenter', function() {
|
| 199 |
-
this.style.background = '#5682b6';
|
| 200 |
-
});
|
| 201 |
-
|
| 202 |
-
document.querySelector('.save-button').addEventListener('mouseleave', function() {
|
| 203 |
-
this.style.background = '#6391C5';
|
| 204 |
-
});
|
| 205 |
-
</script>
|
| 206 |
-
{% endblock %}
|
| 207 |
-
|
| 208 |
-
{% block extra_js %}
|
| 209 |
-
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 210 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
| 211 |
-
<script src="{{ url_for('static', filename='js/editor.js') }}"></script>
|
| 212 |
{% endblock %}
|
|
|
|
| 1 |
+
{% extends "base.html" %}
|
| 2 |
+
|
| 3 |
+
{% block title %}{% if article %}编辑文章{% else %}新建文章{% endif %} - Wisdom Hub{% endblock %}
|
| 4 |
+
|
| 5 |
+
{% block content %}
|
| 6 |
+
<div class="editor-container" style="
|
| 7 |
+
max-width: 1400px;
|
| 8 |
+
margin: 0 auto;
|
| 9 |
+
display: flex;
|
| 10 |
+
flex-direction: column;
|
| 11 |
+
gap: 1rem;
|
| 12 |
+
height: calc(100vh - 8rem);
|
| 13 |
+
padding: 0 1rem;
|
| 14 |
+
">
|
| 15 |
+
<!-- 标题区域 -->
|
| 16 |
+
<div class="editor-header" style="
|
| 17 |
+
background: white;
|
| 18 |
+
border-radius: 8px;
|
| 19 |
+
padding: 1.25rem;
|
| 20 |
+
border: 1px solid #B3CFEF;
|
| 21 |
+
">
|
| 22 |
+
<input type="text" id="titleInput" placeholder="请输入文章标题..." value="{{ article.title if article else '' }}" style="
|
| 23 |
+
width: 100%;
|
| 24 |
+
font-size: 1.5rem;
|
| 25 |
+
border: none;
|
| 26 |
+
outline: none;
|
| 27 |
+
color: #2C3E50;
|
| 28 |
+
">
|
| 29 |
+
</div>
|
| 30 |
+
|
| 31 |
+
<!-- 工具栏 -->
|
| 32 |
+
<div class="editor-toolbar" style="
|
| 33 |
+
background: white;
|
| 34 |
+
border-radius: 8px;
|
| 35 |
+
padding: 0.5rem;
|
| 36 |
+
display: flex;
|
| 37 |
+
gap: 0.25rem;
|
| 38 |
+
flex-wrap: wrap;
|
| 39 |
+
border: 1px solid #B3CFEF;
|
| 40 |
+
"></div>
|
| 41 |
+
|
| 42 |
+
<!-- 编辑器主体 -->
|
| 43 |
+
<div class="editor-main" style="
|
| 44 |
+
display: grid;
|
| 45 |
+
grid-template-columns: 1fr 1fr;
|
| 46 |
+
gap: 1rem;
|
| 47 |
+
flex: 1;
|
| 48 |
+
min-height: 0;
|
| 49 |
+
">
|
| 50 |
+
<!-- 编辑区域 -->
|
| 51 |
+
<textarea id="contentInput" placeholder="开始写作..." style="
|
| 52 |
+
background: white;
|
| 53 |
+
border-radius: 8px;
|
| 54 |
+
padding: 1.25rem;
|
| 55 |
+
border: 1px solid #B3CFEF;
|
| 56 |
+
font-family: 'Monaco', 'Consolas', monospace;
|
| 57 |
+
font-size: 0.9375rem;
|
| 58 |
+
line-height: 1.6;
|
| 59 |
+
color: #2C3E50;
|
| 60 |
+
resize: none;
|
| 61 |
+
outline: none;
|
| 62 |
+
">{{ article.content if article else '' }}</textarea>
|
| 63 |
+
|
| 64 |
+
<!-- 预览区域 -->
|
| 65 |
+
<div id="preview" class="markdown-preview" style="
|
| 66 |
+
background: white;
|
| 67 |
+
border-radius: 8px;
|
| 68 |
+
padding: 1.25rem;
|
| 69 |
+
border: 1px solid #B3CFEF;
|
| 70 |
+
overflow-y: auto;
|
| 71 |
+
color: #2C3E50;
|
| 72 |
+
"></div>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<!-- 底部工具栏 -->
|
| 76 |
+
<div class="editor-footer" style="
|
| 77 |
+
background: white;
|
| 78 |
+
border-radius: 8px;
|
| 79 |
+
padding: 0.75rem 1.25rem;
|
| 80 |
+
display: flex;
|
| 81 |
+
justify-content: space-between;
|
| 82 |
+
align-items: center;
|
| 83 |
+
border: 1px solid #B3CFEF;
|
| 84 |
+
">
|
| 85 |
+
<div class="word-count" style="
|
| 86 |
+
color: #6391C5;
|
| 87 |
+
font-size: 0.875rem;
|
| 88 |
+
"></div>
|
| 89 |
+
|
| 90 |
+
<button class="save-button" style="
|
| 91 |
+
padding: 0.5rem 1rem;
|
| 92 |
+
background: #6391C5;
|
| 93 |
+
color: white;
|
| 94 |
+
border: none;
|
| 95 |
+
border-radius: 4px;
|
| 96 |
+
font-size: 0.875rem;
|
| 97 |
+
cursor: pointer;
|
| 98 |
+
transition: background-color 0.2s;
|
| 99 |
+
display: flex;
|
| 100 |
+
align-items: center;
|
| 101 |
+
gap: 0.5rem;
|
| 102 |
+
">
|
| 103 |
+
<i class="fas fa-save" style="font-size: 0.875rem;"></i>
|
| 104 |
+
保存文章
|
| 105 |
+
</button>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<!-- 图片上传输入框 -->
|
| 110 |
+
<input type="file" id="imageInput" style="display: none" accept="image/*">
|
| 111 |
+
|
| 112 |
+
<style>
|
| 113 |
+
/* 工具栏按钮基础样式 */
|
| 114 |
+
.toolbar-button {
|
| 115 |
+
width: 32px;
|
| 116 |
+
height: 32px;
|
| 117 |
+
display: flex;
|
| 118 |
+
align-items: center;
|
| 119 |
+
justify-content: center;
|
| 120 |
+
border: 1px solid transparent;
|
| 121 |
+
border-radius: 4px;
|
| 122 |
+
color: #6391C5;
|
| 123 |
+
background: none;
|
| 124 |
+
cursor: pointer;
|
| 125 |
+
transition: all 0.2s;
|
| 126 |
+
font-size: 0.9375rem;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.toolbar-button:hover {
|
| 130 |
+
background: #f8fafc;
|
| 131 |
+
border-color: #B3CFEF;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
/* 预览区域样式优化 */
|
| 135 |
+
.markdown-preview h1,
|
| 136 |
+
.markdown-preview h2,
|
| 137 |
+
.markdown-preview h3 {
|
| 138 |
+
margin-top: 1.5em;
|
| 139 |
+
margin-bottom: 1em;
|
| 140 |
+
color: #2C3E50;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.markdown-preview code {
|
| 144 |
+
background: #f8fafc;
|
| 145 |
+
padding: 0.2em 0.4em;
|
| 146 |
+
border-radius: 4px;
|
| 147 |
+
font-size: 0.9em;
|
| 148 |
+
color: #6391C5;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.markdown-preview pre {
|
| 152 |
+
background: #f8fafc;
|
| 153 |
+
padding: 1rem;
|
| 154 |
+
border-radius: 4px;
|
| 155 |
+
border: 1px solid #B3CFEF;
|
| 156 |
+
overflow-x: auto;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.markdown-preview pre code {
|
| 160 |
+
background: none;
|
| 161 |
+
padding: 0;
|
| 162 |
+
border-radius: 0;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.markdown-preview blockquote {
|
| 166 |
+
border-left: 4px solid #B3CFEF;
|
| 167 |
+
margin: 1em 0;
|
| 168 |
+
padding-left: 1em;
|
| 169 |
+
color: #64748b;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
.markdown-preview img {
|
| 173 |
+
max-width: 100%;
|
| 174 |
+
border-radius: 4px;
|
| 175 |
+
}
|
| 176 |
+
</style>
|
| 177 |
+
|
| 178 |
+
<script>
|
| 179 |
+
// 编辑区域焦点效果
|
| 180 |
+
document.getElementById('contentInput').addEventListener('focus', function() {
|
| 181 |
+
this.style.borderColor = '#6391C5';
|
| 182 |
+
});
|
| 183 |
+
|
| 184 |
+
document.getElementById('contentInput').addEventListener('blur', function() {
|
| 185 |
+
this.style.borderColor = '#B3CFEF';
|
| 186 |
+
});
|
| 187 |
+
|
| 188 |
+
// 标题输入框焦点效果
|
| 189 |
+
document.getElementById('titleInput').addEventListener('focus', function() {
|
| 190 |
+
this.style.borderColor = '#6391C5';
|
| 191 |
+
});
|
| 192 |
+
|
| 193 |
+
document.getElementById('titleInput').addEventListener('blur', function() {
|
| 194 |
+
this.style.borderColor = '#B3CFEF';
|
| 195 |
+
});
|
| 196 |
+
|
| 197 |
+
// 保存按钮悬停效果
|
| 198 |
+
document.querySelector('.save-button').addEventListener('mouseenter', function() {
|
| 199 |
+
this.style.background = '#5682b6';
|
| 200 |
+
});
|
| 201 |
+
|
| 202 |
+
document.querySelector('.save-button').addEventListener('mouseleave', function() {
|
| 203 |
+
this.style.background = '#6391C5';
|
| 204 |
+
});
|
| 205 |
+
</script>
|
| 206 |
+
{% endblock %}
|
| 207 |
+
|
| 208 |
+
{% block extra_js %}
|
| 209 |
+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 210 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
| 211 |
+
<script src="{{ url_for('static', filename='js/editor.js') }}"></script>
|
| 212 |
{% endblock %}
|