From ec6f207325f1996d71fb4e0c6acada906ec026bd Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Fri, 04 Mar 2022 18:38:32 +0800
Subject: [PATCH] css 抽取

---
 src/components/group/MyPreviewModal.vue |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/components/group/MyPreviewModal.vue b/src/components/group/MyPreviewModal.vue
index 0faa89e..21fad6f 100644
--- a/src/components/group/MyPreviewModal.vue
+++ b/src/components/group/MyPreviewModal.vue
@@ -1,11 +1,12 @@
 <template>
 	<div class="myModal">
-		<a-modal v-model="visible" title="编辑预览" on-ok="handleOk" width="90%" :footer="null"
-			:bodyStyle="{'overflow':'overlay','width': '100%','height': '100%'}">
+		<a-modal v-model="visible" title="编辑预览" width="60%" :footer="null"
+			:bodyStyle="{'overflow':'overlay','width': '100%','height': '700px'}">
 			<div style="display: flex;">
-				<a-textarea style="height: 750px;min-width: 50%" v-model="text" :rows="4" />
-				<div class="markdown-body article-detail" style="min-width: 50%;">
-					<vue-markdown  :source="text"></vue-markdown>
+				<a-textarea id="myInput" style="height: 750px;min-width: 50%" v-model="text"
+					@keydown.9.native.prevent="tabFunc" />
+				<div class="markdown-body article-detail" style="min-width: 50%;border: 1px solid #d9d9d9;">
+					<vue-markdown :source="text"></vue-markdown>
 				</div>
 			</div>
 		</a-modal>
@@ -15,6 +16,7 @@
 
 <script>
 	import VueMarkdown from 'vue-markdown'
+	
 
 	import md5 from 'js-md5';
 	export default {
@@ -24,20 +26,32 @@
 		data() {
 			return {
 				visible: false,
-				text: "### 长安古意   \r* 十里平湖霜满天 \r* 寸寸青丝愁华年 \r* 对月形单望相护 \r* 只羡鸳鸯不羡仙 ",
+				text: "### &ensp;&ensp;十里平湖 \r> ##### (卢照邻)  \r> 化自《长安古意》 \r* 十里平湖霜满天 \r* 寸寸青丝愁华年 \r* 对月形单望相护 \r* 只羡鸳鸯不羡仙 \r![](http://blog.inleft.com/photo/example.jpg)",
 			}
 		},
 		methods: {
+			tabFunc() {
+				this.insertInputTxt('myInput', '\t')
+			},
+			insertInputTxt(id, insertTxt) {
+				var elInput = document.getElementById(id);
+				var startPos = elInput.selectionStart
+				var endPos = elInput.selectionEnd
+				if (startPos === undefined || endPos === undefined) return
+				var txt = elInput.value
+				var result = txt.substring(0, startPos) + insertTxt + txt.substring(endPos)
+				elInput.value = result
+				elInput.focus()
+				elInput.selectionStart = startPos + insertTxt.length
+				elInput.selectionEnd = startPos + insertTxt.length
+			},
+
 			getCalendarContainer(trigger) {
 				return this.$refs.myModal;
 			},
 			showModal() {
 				this.visible = true;
 			},
-			handleOk(e) {
-				console.log(111);
-			},
-
 			handleCancel(e) {
 				this.visible = false;
 			},

--
Gitblit v1.9.1