refactor timi-web
This commit is contained in:
@@ -1,30 +1,26 @@
|
||||
<template>
|
||||
<t-button v-popup="'代码块'" variant="outline" :theme="active ? 'primary' : 'default'" @click="openDialog">
|
||||
<t-button v-popup="'代码块'" :variant="active ? 'base' : 'text'" :theme="active ? 'light' : 'default'" @click="openDialog">
|
||||
<t-icon name="code" />
|
||||
</t-button>
|
||||
<t-popup
|
||||
<bottom-popup
|
||||
v-model="visible"
|
||||
placement="bottom"
|
||||
title="插入代码块"
|
||||
left-button-text="取消"
|
||||
right-button-text="插入"
|
||||
@left-button-click="visible = false"
|
||||
@right-button-click="onConfirm"
|
||||
destroy-on-close
|
||||
>
|
||||
<div class="form-popup">
|
||||
<div class="popup-head">
|
||||
<span class="title">插入代码块</span>
|
||||
<t-button shape="square" size="small" variant="text" title="关闭" @click="visible = false">
|
||||
<t-icon name="close" />
|
||||
</t-button>
|
||||
</div>
|
||||
<t-input v-model="codeLanguage" placeholder="代码语言,可留空" />
|
||||
<div class="popup-actions">
|
||||
<t-button variant="outline" block @click="visible = false">取消</t-button>
|
||||
<t-button theme="primary" block @click="onConfirm">插入</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</t-popup>
|
||||
</bottom-popup>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TiptapEditorInstance } from "timi-web/editor";
|
||||
import BottomPopup from "../bottom-popup/index.vue";
|
||||
|
||||
defineOptions({
|
||||
name: "TiptapCodeBlockButton"
|
||||
@@ -69,27 +65,5 @@ function onConfirm() {
|
||||
overflow-y: auto;
|
||||
background: var(--td-bg-color-container);
|
||||
|
||||
.popup-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
.title {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary, #000);
|
||||
}
|
||||
}
|
||||
|
||||
.popup-actions {
|
||||
gap: .75rem;
|
||||
display: flex;
|
||||
margin-top: 1rem;
|
||||
|
||||
:deep(.t-button) {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user