diff --git a/src/assets/styles/prosemirror.scss b/src/assets/styles/prosemirror.scss
index cc43fca5..c748a397 100644
--- a/src/assets/styles/prosemirror.scss
+++ b/src/assets/styles/prosemirror.scss
@@ -15,6 +15,10 @@
color: inherit;
}
+ p {
+ text-indent: var(--textIndent);
+ }
+
p + p {
margin-top: 5px;
}
diff --git a/src/types/slides.ts b/src/types/slides.ts
index 4d2110e0..a3c413d1 100644
--- a/src/types/slides.ts
+++ b/src/types/slides.ts
@@ -141,6 +141,7 @@ export interface PPTTextElement extends PPTBaseElement {
wordSpace?: number;
opacity?: number;
shadow?: PPTElementShadow;
+ textIndent?: number;
}
diff --git a/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue b/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue
index 5b06ba65..81412f82 100644
--- a/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue
+++ b/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue
@@ -234,6 +234,13 @@
{{item}}px
+
+
首行缩进:
+
+
文本框填充:
@@ -368,6 +375,7 @@ export default defineComponent({
const fill = ref()
const lineHeight = ref()
const wordSpace = ref()
+ const textIndent = ref()
watch(handleElement, () => {
if (!handleElement.value || handleElement.value.type !== 'text') return
@@ -375,6 +383,7 @@ export default defineComponent({
fill.value = handleElement.value.fill || '#fff'
lineHeight.value = handleElement.value.lineHeight || 1.5
wordSpace.value = handleElement.value.wordSpace || 0
+ textIndent.value = handleElement.value.textIndent || 0
}, { deep: true, immediate: true })
const fontSizeOptions = [
@@ -384,6 +393,7 @@ export default defineComponent({
]
const lineHeightOptions = [0.9, 1.0, 1.15, 1.2, 1.4, 1.5, 1.8, 2.0, 2.5, 3.0]
const wordSpaceOptions = [0, 1, 2, 3, 4, 5, 6, 8, 10]
+ const textIndentOptions = [0, 48, 96, 144, 192, 240, 288, 336]
// 设置行高
const updateLineHeight = (value: number) => {
@@ -395,6 +405,11 @@ export default defineComponent({
updateElement({ wordSpace: value })
}
+ // 设置字间距
+ const updateTextIndent = (value: number) => {
+ updateElement({ textIndent: value })
+ }
+
// 设置文本框填充
const updateFill = (value: string) => {
updateElement({ fill: value })
@@ -433,14 +448,17 @@ export default defineComponent({
fill,
lineHeight,
wordSpace,
+ textIndent,
richTextAttrs,
availableFonts,
webFonts,
fontSizeOptions,
lineHeightOptions,
wordSpaceOptions,
+ textIndentOptions,
updateLineHeight,
updateWordSpace,
+ updateTextIndent,
updateFill,
emitRichTextCommand,
emitBatchRichTextCommand,
diff --git a/src/views/components/element/TextElement/BaseTextElement.vue b/src/views/components/element/TextElement/BaseTextElement.vue
index bc969868..ab3ea9ff 100644
--- a/src/views/components/element/TextElement/BaseTextElement.vue
+++ b/src/views/components/element/TextElement/BaseTextElement.vue
@@ -28,7 +28,11 @@
:height="elementInfo.height"
:outline="elementInfo.outline"
/>
-
+
diff --git a/src/views/components/element/TextElement/index.vue b/src/views/components/element/TextElement/index.vue
index 19699689..267fdf04 100644
--- a/src/views/components/element/TextElement/index.vue
+++ b/src/views/components/element/TextElement/index.vue
@@ -39,6 +39,7 @@
:defaultFontName="elementInfo.defaultFontName"
:editable="!elementInfo.lock"
:value="elementInfo.content"
+ :style="{ '--textIndent': `${elementInfo.textIndent || 0}px` }"
@update="value => updateContent(value)"
@blur="checkEmptyText()"
@mousedown="$event => handleSelectElement($event, false)"