@a3s-lab/office 0.27.0 → 0.28.0
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/README.md +15 -1
- package/dist/0~5093.js +103 -3
- package/dist/0~document-editor.js +197 -6
- package/dist/0~work-docx-export.js +257 -19
- package/dist/0~work-docx-import.js +4 -2
- package/dist/0~work-office-diagnostics.js +54 -3
- package/dist/5184.js +13 -0
- package/dist/6282.js +165 -2
- package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +28 -0
- package/dist/internal/features/work/work-document-format-changes.d.ts +4 -0
- package/dist/internal/features/work/work-document-legacy-text-effects.d.ts +27 -0
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +4 -0
- package/dist/internal/features/work/work-docx-hidden-text-export.d.ts +1 -0
- package/dist/internal/features/work/work-docx-legacy-text-effects-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-legacy-text-effects-export.d.ts +18 -0
- package/dist/internal/features/work/work-docx-legacy-text-effects.d.ts +12 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +4 -0
- package/dist/internal/features/work/work-docx-run-property-order.d.ts +2 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +41 -0
- package/docs/latest/en/browser-editor-architecture.md +14 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ baseline rather than one specific release.
|
|
|
110
110
|
|
|
111
111
|
| Capability | A3S Office today | Traditional Office baseline |
|
|
112
112
|
| --- | --- | --- |
|
|
113
|
-
| Text, paragraphs, lists, and styles | **Supported** — structured editing, independent native ASCII, high ANSI, East Asian, and complex-script font slots with direct/theme identity, native all-caps and small-caps effects, exact DOCX character scale plus signed spacing, half-point kerning thresholds, all five native East Asian emphasis marks, native hidden text with explicit visible resets, and baseline position in one advanced font dialog, all 18 native DOCX underline values with direct or theme color identity, independent native single/double strikethrough with explicit resets, formatting revisions, clipboard, format painter, and undo/redo | Mature authoring with a broader long-tail style and typography catalog |
|
|
113
|
+
| Text, paragraphs, lists, and styles | **Supported** — structured editing, independent native ASCII, high ANSI, East Asian, and complex-script font slots with direct/theme identity, native all-caps and small-caps effects, exact DOCX character scale plus signed spacing, half-point kerning thresholds, all five native East Asian emphasis marks, native hidden text with explicit visible resets, four independent native outline/shadow/emboss/imprint effects with conflict-safe authoring, and baseline position in one advanced font dialog, all 18 native DOCX underline values with direct or theme color identity, independent native single/double strikethrough with explicit resets, formatting revisions, clipboard, format painter, and undo/redo | Mature authoring with a broader long-tail style and typography catalog |
|
|
114
114
|
| Page layout and rendering | **Partial** — sections, margins, page size, columns, headers/footers, fields, and live pagination | Desktop-grade pagination, print layout, and vector output |
|
|
115
115
|
| Tables, pictures, and equations | **Partial** — rich table geometry, floating pictures, crop/wrap, and structured OMML | Broader drawings, text boxes, charts, WordArt, and SmartArt |
|
|
116
116
|
| Comments, revisions, and collaboration | **Partial** — comments, suggestions, text/format revisions, decisions, Yjs presence, and host relay contracts | Full revision families plus integrated sharing and review services |
|
|
@@ -719,6 +719,19 @@ it. Unchanged comment XML remains source-preserved without claiming rich
|
|
|
719
719
|
comment-text editing, and affected paragraphs use browser-authoritative line
|
|
720
720
|
measurement so invisible glyphs never distort Worker/WASM pagination.
|
|
721
721
|
|
|
722
|
+
Native Writer outline, shadow, emboss, and imprint retain four independent
|
|
723
|
+
nullable TextStyle properties backed by exact `w:outline`, `w:shadow`,
|
|
724
|
+
`w:emboss`, and `w:imprint` values. Missing properties continue style
|
|
725
|
+
inheritance and explicit false values remain native resets. Outline and shadow
|
|
726
|
+
can be enabled together; emboss and imprint are mutually exclusive with every
|
|
727
|
+
other enabled effect. The shared `Cmd/Ctrl+D` dialog exposes four independently
|
|
728
|
+
mixed checkboxes, clears conflicts in the same transaction, and creates one
|
|
729
|
+
Undo record. Body text, page chrome, notes, Format Painter, formatting
|
|
730
|
+
revisions, strict/transitional import, exact export, and reopen share the same
|
|
731
|
+
model. CSS provides bounded browser and PDF paint projections while eligible
|
|
732
|
+
paragraphs remain on the Worker/WASM layout path. The Playground's **文字效果**
|
|
733
|
+
template demonstrates all four effects and the conflict-safe transition.
|
|
734
|
+
|
|
722
735
|
Supported native OMML equations now survive as bounded structured objects in
|
|
723
736
|
the document body, headers, footers, footnotes, and endnotes. Inline and display
|
|
724
737
|
math, Unicode runs with literal/normal-text semantics, math script/style,
|
|
@@ -1419,6 +1432,7 @@ without hard-coded return URLs.
|
|
|
1419
1432
|
|
|
1420
1433
|
- [Live Playground](https://a3s-lab.github.io/Office/)
|
|
1421
1434
|
- [Documentation center](https://a3s-lab.github.io/Office/docs/)
|
|
1435
|
+
- [A3S Office 0.28.0 documentation](https://a3s-lab.github.io/Office/docs/0.28.0/)
|
|
1422
1436
|
- [A3S Office 0.27.0 documentation](https://a3s-lab.github.io/Office/docs/0.27.0/)
|
|
1423
1437
|
- [A3S Office 0.26.0 documentation](https://a3s-lab.github.io/Office/docs/0.26.0/)
|
|
1424
1438
|
- [A3S Office 0.25.0 documentation](https://a3s-lab.github.io/Office/docs/0.25.0/)
|
package/dist/0~5093.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { descendants, directChildren as work_ooxml_package_directChildren, xmlNamespacePrefix, directChild, attribute as work_ooxml_package_attribute, childPath } from "./5184.js";
|
|
2
2
|
import { docxThemeFont, XML_NAMESPACE as work_docx_settings_xml_XML_NAMESPACE, XMLNS_NAMESPACE as work_docx_settings_xml_XMLNS_NAMESPACE, STRICT_WORDPROCESSING_NAMESPACE, docxCharacterSpacingTwipsFromProperties, parseBoundedDocxInteger, xmlAttributeLocalName, docxCharacterScalePercentFromProperties, resolveDocxEmphasisMark, docxCharacterPositionHalfPointsFromProperties, docxThemeColor, parseDocxParagraphDefaultCollapsed, resolveDocxKerningThresholdHalfPoints, resolveDocxThemeResolver as work_docx_theme_resolveDocxThemeResolver, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, parseDocxTwipsMeasure } from "./0~7043.js";
|
|
3
|
-
import { normalizeDocumentEmphasisMark, normalizeDocumentPageBorders, normalizeDocumentParagraphBorder, documentCharacterPositionDomAttributes, DOCUMENT_PAGE_BORDER_EDGES, normalizeDocumentTabStops, documentTextCaseFromWordFlags, DOCUMENT_PARAGRAPH_SHADING_PATTERNS, documentStrikeDomAttributes, documentAutoLineHeight, documentScriptFontFallbackSlots, normalizeDocumentUnderlineColor, documentScriptFontsDomAttributes, documentKerningDomAttributes, documentCharacterScaleDomAttributes, documentParagraphShadingDomAttributes, serializeDocxThemeReference, documentParagraphBordersDomAttributes, normalizeDocumentScriptFontHint, serializeDocumentParagraphFormatting, normalizeDocumentPaperSource, documentEquationText, normalizeDocumentScriptFonts, DOCUMENT_PARAGRAPH_BORDER_STYLES, normalizeDocumentParagraphBorders as work_document_paragraph_borders_normalizeDocumentParagraphBorders, DOCUMENT_PARAGRAPH_BORDER_EDGES, normalizeDocumentParagraphIndent, documentScriptFontFamily, normalizeDocumentThemeFont, documentCharacterSpacingDomAttributes,
|
|
3
|
+
import { normalizeDocumentEmphasisMark, documentWordLineHeightFactor, normalizeDocumentPageBorders, normalizeDocumentParagraphBorder, documentCharacterPositionDomAttributes, DOCUMENT_PAGE_BORDER_EDGES, normalizeDocumentTabStops, documentTextCaseFromWordFlags, DOCUMENT_PARAGRAPH_SHADING_PATTERNS, documentStrikeDomAttributes, documentAutoLineHeight, documentScriptFontFallbackSlots, normalizeDocumentUnderlineColor, documentScriptFontsDomAttributes, documentKerningDomAttributes, documentCharacterScaleDomAttributes, documentParagraphShadingDomAttributes, serializeDocxThemeReference, documentParagraphBordersDomAttributes, normalizeDocumentScriptFontHint, serializeDocumentParagraphFormatting, normalizeDocumentPaperSource, documentEquationText, normalizeDocumentScriptFonts, documentLegacyTextEffectsDomAttributes, documentLegacyTextEffectsConflict, DOCUMENT_PARAGRAPH_BORDER_STYLES, normalizeDocumentParagraphBorders as work_document_paragraph_borders_normalizeDocumentParagraphBorders, DOCUMENT_PARAGRAPH_BORDER_EDGES, normalizeDocumentParagraphIndent, documentScriptFontFamily, normalizeDocumentEquation, normalizeDocumentThemeFont, documentCharacterSpacingDomAttributes, renderDocumentAutoLineHeight, documentUnderlineDomAttributes, normalizeDocumentUnderlineStyle, normalizeDocumentFontName, applyDocumentTextCaseStyle, documentHiddenTextDomAttributes, importedDocumentCharacterFormatting, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, createDocumentEquationElement, normalizeDocumentPageGeometry, serializeDocumentTabStops, documentEmphasisMarkDomAttributes, normalizeDocumentPageMargins, documentScriptFontSegments } from "./6282.js";
|
|
4
4
|
function docxCaptionSequenceKind(instruction) {
|
|
5
5
|
const identifier = /^\s*SEQ\s+([^\s\\]+)/i.exec(instruction)?.[1]?.toLowerCase();
|
|
6
6
|
if (!identifier) return null;
|
|
@@ -4132,6 +4132,70 @@ function resolveDocxHiddenText(propertySources) {
|
|
|
4132
4132
|
}
|
|
4133
4133
|
return hiddenText;
|
|
4134
4134
|
}
|
|
4135
|
+
const work_docx_legacy_text_effects_ON_VALUES = new Set([
|
|
4136
|
+
'1',
|
|
4137
|
+
'on',
|
|
4138
|
+
'true'
|
|
4139
|
+
]);
|
|
4140
|
+
const work_docx_legacy_text_effects_OFF_VALUES = new Set([
|
|
4141
|
+
'0',
|
|
4142
|
+
'off',
|
|
4143
|
+
'false'
|
|
4144
|
+
]);
|
|
4145
|
+
function inspectDocxLegacyTextEffects(properties) {
|
|
4146
|
+
if (!properties) return {
|
|
4147
|
+
status: 'absent'
|
|
4148
|
+
};
|
|
4149
|
+
const effects = {};
|
|
4150
|
+
let present = false;
|
|
4151
|
+
for (const name of DOCUMENT_LEGACY_TEXT_EFFECT_NAMES){
|
|
4152
|
+
const localMatches = work_ooxml_package_directChildren(properties, name);
|
|
4153
|
+
if (!localMatches.length) continue;
|
|
4154
|
+
present = true;
|
|
4155
|
+
const nativeMatches = localMatches.filter((element)=>DOCX_WORDPROCESSING_NAMESPACES.has(element.namespaceURI ?? ''));
|
|
4156
|
+
if (1 !== localMatches.length || 1 !== nativeMatches.length) return {
|
|
4157
|
+
status: 'invalid'
|
|
4158
|
+
};
|
|
4159
|
+
const value = inspectOnOffLeaf(nativeMatches[0]);
|
|
4160
|
+
if (null === value) return {
|
|
4161
|
+
status: 'invalid'
|
|
4162
|
+
};
|
|
4163
|
+
effects[name] = value;
|
|
4164
|
+
}
|
|
4165
|
+
if (!present) return {
|
|
4166
|
+
status: 'absent'
|
|
4167
|
+
};
|
|
4168
|
+
return documentLegacyTextEffectsConflict(effects) ? {
|
|
4169
|
+
status: 'invalid'
|
|
4170
|
+
} : {
|
|
4171
|
+
status: 'valid',
|
|
4172
|
+
value: effects
|
|
4173
|
+
};
|
|
4174
|
+
}
|
|
4175
|
+
function resolveDocxLegacyTextEffects(propertySources) {
|
|
4176
|
+
const effects = {};
|
|
4177
|
+
let present = false;
|
|
4178
|
+
for (const properties of propertySources){
|
|
4179
|
+
const inspection = inspectDocxLegacyTextEffects(properties);
|
|
4180
|
+
if ('invalid' === inspection.status) return;
|
|
4181
|
+
if ('valid' === inspection.status) {
|
|
4182
|
+
Object.assign(effects, inspection.value);
|
|
4183
|
+
present = true;
|
|
4184
|
+
if (documentLegacyTextEffectsConflict(effects)) return;
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
return present ? effects : void 0;
|
|
4188
|
+
}
|
|
4189
|
+
function inspectOnOffLeaf(element) {
|
|
4190
|
+
if (work_ooxml_package_directChildren(element).length || Array.from(element.childNodes).some((node)=>(node.nodeType === Node.TEXT_NODE || node.nodeType === Node.CDATA_SECTION_NODE) && Boolean(node.textContent?.trim()))) return null;
|
|
4191
|
+
const attributes = Array.from(element.attributes).filter((attribute)=>xmlAttributeNamespace(element, attribute) !== work_docx_settings_xml_XMLNS_NAMESPACE && 'xmlns' !== attribute.name && !attribute.name.startsWith('xmlns:'));
|
|
4192
|
+
if (!attributes.length) return true;
|
|
4193
|
+
if (1 !== attributes.length || 'val' !== xmlAttributeLocalName(attributes[0]) || !DOCX_WORDPROCESSING_NAMESPACES.has(xmlAttributeNamespace(element, attributes[0]) ?? '')) return null;
|
|
4194
|
+
const value = attributes[0].value;
|
|
4195
|
+
if (work_docx_legacy_text_effects_ON_VALUES.has(value)) return true;
|
|
4196
|
+
if (work_docx_legacy_text_effects_OFF_VALUES.has(value)) return false;
|
|
4197
|
+
return null;
|
|
4198
|
+
}
|
|
4135
4199
|
const MAX_STYLE_INHERITANCE_DEPTH = 64;
|
|
4136
4200
|
function createDocxParagraphStyleResolver(stylesDocument) {
|
|
4137
4201
|
if (!stylesDocument) return {
|
|
@@ -6807,6 +6871,10 @@ const SUPPORTED_RUN_PROPERTY_CHANGE_CHILDREN = new Set([
|
|
|
6807
6871
|
'u',
|
|
6808
6872
|
'strike',
|
|
6809
6873
|
'dstrike',
|
|
6874
|
+
'outline',
|
|
6875
|
+
'shadow',
|
|
6876
|
+
'emboss',
|
|
6877
|
+
'imprint',
|
|
6810
6878
|
'caps',
|
|
6811
6879
|
'smallCaps',
|
|
6812
6880
|
'vanish',
|
|
@@ -6928,6 +6996,7 @@ function resolvedRunFormatting(propertySources, theme, runText, requestedFontSlo
|
|
|
6928
6996
|
const kerningThresholdHalfPoints = resolveDocxKerningThresholdHalfPoints(propertySources);
|
|
6929
6997
|
const emphasisMark = resolveDocxEmphasisMark(propertySources);
|
|
6930
6998
|
const hiddenText = resolveDocxHiddenText(propertySources);
|
|
6999
|
+
const legacyTextEffects = resolveDocxLegacyTextEffects(propertySources);
|
|
6931
7000
|
for (const properties of propertySources){
|
|
6932
7001
|
bold = overriddenBoolean(bold, onOffProperty(properties, 'b'));
|
|
6933
7002
|
complexBold = overriddenBoolean(complexBold, onOffProperty(properties, 'bCs'));
|
|
@@ -7045,6 +7114,18 @@ function resolvedRunFormatting(propertySources, theme, runText, requestedFontSlo
|
|
|
7045
7114
|
...void 0 !== hiddenText ? {
|
|
7046
7115
|
hiddenText
|
|
7047
7116
|
} : {},
|
|
7117
|
+
...legacyTextEffects?.outline !== void 0 ? {
|
|
7118
|
+
legacyTextOutline: legacyTextEffects.outline
|
|
7119
|
+
} : {},
|
|
7120
|
+
...legacyTextEffects?.shadow !== void 0 ? {
|
|
7121
|
+
legacyTextShadow: legacyTextEffects.shadow
|
|
7122
|
+
} : {},
|
|
7123
|
+
...legacyTextEffects?.emboss !== void 0 ? {
|
|
7124
|
+
legacyTextEmboss: legacyTextEffects.emboss
|
|
7125
|
+
} : {},
|
|
7126
|
+
...legacyTextEffects?.imprint !== void 0 ? {
|
|
7127
|
+
legacyTextImprint: legacyTextEffects.imprint
|
|
7128
|
+
} : {},
|
|
7048
7129
|
...fontFamily ? {
|
|
7049
7130
|
fontFamily,
|
|
7050
7131
|
wordLineHeightFactor: documentWordLineHeightFactor(fontFamily)
|
|
@@ -7109,6 +7190,21 @@ function formattingMarkup(document, formatting) {
|
|
|
7109
7190
|
if (void 0 !== formatting.emphasisMark) for (const [name, value] of Object.entries(documentEmphasisMarkDomAttributes(formatting.emphasisMark)))if ('style' === name) span.style.cssText += `; ${value}`;
|
|
7110
7191
|
else span.setAttribute(name, value);
|
|
7111
7192
|
if (void 0 !== formatting.hiddenText) for (const [name, value] of Object.entries(documentHiddenTextDomAttributes(formatting.hiddenText)))span.setAttribute(name, value);
|
|
7193
|
+
const legacyTextEffects = {
|
|
7194
|
+
...void 0 !== formatting.legacyTextOutline ? {
|
|
7195
|
+
outline: formatting.legacyTextOutline
|
|
7196
|
+
} : {},
|
|
7197
|
+
...void 0 !== formatting.legacyTextShadow ? {
|
|
7198
|
+
shadow: formatting.legacyTextShadow
|
|
7199
|
+
} : {},
|
|
7200
|
+
...void 0 !== formatting.legacyTextEmboss ? {
|
|
7201
|
+
emboss: formatting.legacyTextEmboss
|
|
7202
|
+
} : {},
|
|
7203
|
+
...void 0 !== formatting.legacyTextImprint ? {
|
|
7204
|
+
imprint: formatting.legacyTextImprint
|
|
7205
|
+
} : {}
|
|
7206
|
+
};
|
|
7207
|
+
for (const [name, value] of Object.entries(documentLegacyTextEffectsDomAttributes(legacyTextEffects)))span.setAttribute(name, value);
|
|
7112
7208
|
if (void 0 !== formatting.wordLineHeightFactor) {
|
|
7113
7209
|
const factor = formatLineHeightFactor(formatting.wordLineHeightFactor);
|
|
7114
7210
|
span.dataset.officeWordLineHeightFactor = factor;
|
|
@@ -7195,7 +7291,11 @@ function importedRunFormattingChange(runProperties, paragraphProperties, styles,
|
|
|
7195
7291
|
themeFill: serializeDocxThemeReference(beforeFormatting.themeFill ?? null),
|
|
7196
7292
|
scriptFonts: beforeFormatting.scriptFonts,
|
|
7197
7293
|
scriptFontSlot: beforeFormatting.scriptFontSlot,
|
|
7198
|
-
textCase: beforeFormatting.textCase
|
|
7294
|
+
textCase: beforeFormatting.textCase,
|
|
7295
|
+
legacyTextOutline: beforeFormatting.legacyTextOutline,
|
|
7296
|
+
legacyTextShadow: beforeFormatting.legacyTextShadow,
|
|
7297
|
+
legacyTextEmboss: beforeFormatting.legacyTextEmboss,
|
|
7298
|
+
legacyTextImprint: beforeFormatting.legacyTextImprint
|
|
7199
7299
|
})
|
|
7200
7300
|
};
|
|
7201
7301
|
}
|
|
@@ -7358,4 +7458,4 @@ function work_docx_run_formatting_import_formatNumber(value) {
|
|
|
7358
7458
|
function formatLineHeightFactor(value) {
|
|
7359
7459
|
return Number(value.toFixed(4)).toString();
|
|
7360
7460
|
}
|
|
7361
|
-
export { applyImportedDocxEquationMarkers, applyImportedDocxParagraphAlignmentMarkers, applyImportedDocxParagraphBorderMarkers, applyImportedDocxParagraphDirectionMarkers, applyImportedDocxParagraphFormattingChangeMarkers, applyImportedDocxParagraphIndentMarkers, applyImportedDocxParagraphPaginationMarkers, applyImportedDocxParagraphShadingMarkers, applyImportedDocxParagraphSpacingMarkers, applyImportedDocxParagraphTabStopMarkers, applyImportedDocxRunFormattingMarkers, createDocxParagraphStyleResolver, createDocxTableStyleResolver, createImportedDocxRunFormattingMarkerState, docxCaptionBookmark, docxCaptionReferenceTarget, docxCaptionSequenceKind, docxEquationHtml, docxFieldInstructions, docxFieldOccurrenceIsInlineEditable, docxFieldOccurrences, docxFieldResultText, docxRunPropertySources, docxTableCellStyleLayers, docxTablePropertySources, docxTableRunPropertySources, hasImportedDocxParagraphAlignmentMarkers, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphIndentMarkers, hasImportedDocxParagraphPaginationMarkers, hasImportedDocxParagraphShadingMarkers, hasImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphTabStopMarkers, hasImportedDocxRunFormattingMarkers, hasInvalidDocxFieldStructure, importedDocxStrike, importedDocxUnderline, inspectDocxEquation, inspectDocxHiddenText, inspectDocxPageBorders, inspectDocxPageMarginSettings, inspectDocxPageMargins, inspectDocxPageSize, inspectDocxPaperSource, inspectDocxRunFonts, isDocxEquationLikeRoot, isSupportedDocxEquationPlacement, isSupportedDocxParagraphFormattingChange, isSupportedDocxRunFormattingChange, markDocxPackageEquations, markDocxParagraphAlignments, markDocxParagraphBorders, markDocxParagraphDirections, markDocxParagraphFormattingChanges, markDocxParagraphIndents, markDocxParagraphPagination, markDocxParagraphShading, markDocxParagraphSpacing, markDocxParagraphTabStops, markDocxRunFormattingIntoState, parseDirectDocxParagraphShading, parseDocxPageBorders, parseDocxPageGeometry, parseDocxPageMargins, parseDocxPaperSource, resolveDocxHiddenText, resolveDocxParagraphBordersForParagraph, resolveDocxTableStyleResolver };
|
|
7461
|
+
export { applyImportedDocxEquationMarkers, applyImportedDocxParagraphAlignmentMarkers, applyImportedDocxParagraphBorderMarkers, applyImportedDocxParagraphDirectionMarkers, applyImportedDocxParagraphFormattingChangeMarkers, applyImportedDocxParagraphIndentMarkers, applyImportedDocxParagraphPaginationMarkers, applyImportedDocxParagraphShadingMarkers, applyImportedDocxParagraphSpacingMarkers, applyImportedDocxParagraphTabStopMarkers, applyImportedDocxRunFormattingMarkers, createDocxParagraphStyleResolver, createDocxTableStyleResolver, createImportedDocxRunFormattingMarkerState, docxCaptionBookmark, docxCaptionReferenceTarget, docxCaptionSequenceKind, docxEquationHtml, docxFieldInstructions, docxFieldOccurrenceIsInlineEditable, docxFieldOccurrences, docxFieldResultText, docxRunPropertySources, docxTableCellStyleLayers, docxTablePropertySources, docxTableRunPropertySources, hasImportedDocxParagraphAlignmentMarkers, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphIndentMarkers, hasImportedDocxParagraphPaginationMarkers, hasImportedDocxParagraphShadingMarkers, hasImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphTabStopMarkers, hasImportedDocxRunFormattingMarkers, hasInvalidDocxFieldStructure, importedDocxStrike, importedDocxUnderline, inspectDocxEquation, inspectDocxHiddenText, inspectDocxLegacyTextEffects, inspectDocxPageBorders, inspectDocxPageMarginSettings, inspectDocxPageMargins, inspectDocxPageSize, inspectDocxPaperSource, inspectDocxRunFonts, isDocxEquationLikeRoot, isSupportedDocxEquationPlacement, isSupportedDocxParagraphFormattingChange, isSupportedDocxRunFormattingChange, markDocxPackageEquations, markDocxParagraphAlignments, markDocxParagraphBorders, markDocxParagraphDirections, markDocxParagraphFormattingChanges, markDocxParagraphIndents, markDocxParagraphPagination, markDocxParagraphShading, markDocxParagraphSpacing, markDocxParagraphTabStops, markDocxRunFormattingIntoState, parseDirectDocxParagraphShading, parseDocxPageBorders, parseDocxPageGeometry, parseDocxPageMargins, parseDocxPaperSource, resolveDocxHiddenText, resolveDocxLegacyTextEffects, resolveDocxParagraphBordersForParagraph, resolveDocxTableStyleResolver };
|
|
@@ -15,7 +15,7 @@ import font_size from "@tiptap/extension-text-style/font-size";
|
|
|
15
15
|
import starter_kit from "@tiptap/starter-kit";
|
|
16
16
|
import { BubbleMenu } from "@tiptap/react/menus";
|
|
17
17
|
import { TableMap, isInTable, selectedRect } from "@tiptap/pm/tables";
|
|
18
|
-
import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentScriptFontDirectFamily, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, patchDocumentScriptFonts, documentKerningThresholdPoints, nextDocumentTabAlignment, documentTableRowOptions, normalizedTabPosition, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, documentCitationCount, isDocumentParagraphArtBorderStyle, resolveDocumentPageBorders, documentLazyHtmlChunkFragment, DocumentFontFamily, normalizeDocumentHiddenText, DOCUMENT_CHUNK_VISIBLE_IDS_META, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, retainAnchoredDocumentComments, DocumentTableRowIdentity, work_document_page_margins_twipsToMillimeters, DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, resolveWorkDocumentEditorInput, documentCharacterPositionPoints, documentBulletListStyle, collectDocumentTextLayoutParagraphs, readOfficeDocumentCollaboration as readWorkOfficeDocumentCollaboration, normalizeDocumentCharacterScalePercent, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat, normalizeDocumentPageGeometry, normalizeDocumentImageLayer, documentImageProperties, isValidDocumentCitationTag, sanitizeDocumentPageChromeHtml, pageTwipsToMillimeters, normalizeDocumentPageBorders, parseDocumentScriptFonts, DocumentParagraphFormatting, activeDocumentSection, normalizeDocumentHtml, documentInitialSectionLayout, documentModelHasTrustedInitialIntegrityFeatures, documentParagraphDirection, documentParagraphPagination, documentModelUsesWindowing, documentPageChromeLegacyFields, documentChunkMountedIds, collectDocumentCommentAnchors, documentTextCaseKeyboardShortcuts, DocumentTextStyle, canChangeDocumentIndent, cssDocumentFontFamily, documentCharacterSpacingPoints, documentKerningIsEffective, DocumentSuperscript, documentSectionById, activeDocumentBookmark, DocumentEquation, documentLazyHtmlProjectionFingerprint, documentLazyHtmlProjection, normalizeDocumentParagraphIndent, updateDocumentGutterPosition, DocumentStrike, mountWorkLiveDocumentCapture, registerDocumentPageSurfaceGeometry, documentHiddenTextKeyboardShortcut, syncDocumentContentFromHtml, documentScriptFontSlotFromHint, editorDocumentCaptionTargets, resolveDocumentPageChrome, documentScriptFontFamilyForRendering, documentImageLayoutOptions, MAX_DOCUMENT_NUMBERING_START, resolveDocumentPageSize, editorDocumentBookmarkReferenceTargets, serializeWorkDocumentNode, DOCUMENT_CHUNK_PAGINATION_META, createOfficeDocumentCollaborationBinding as createWorkOfficeDocumentCollaborationBinding, documentModelForContent, normalizeDocumentEmphasisMark, selectedDocumentChunkId, documentCommentViews, documentParagraphSpacing, normalizeDocumentTabStops, patchDocumentLazyHtmlProjection, normalizeDocumentTextCase, serializeDocumentScriptFonts, documentUnderlineColor, documentBookmarkNameExists, collectDocumentChanges, DocumentImage, resolveDocumentPageMargins, updateDocumentPageMarginMode, canSetDocumentTableRowRepeatHeader, normalizeDocumentCharacterSpacingTwips, DocumentCharacterFormatting, millimetersToPixels as work_document_layout_millimetersToPixels, DOCUMENT_CHUNK_HYDRATION_META, documentTabLeaderLabel, createSchemaDerivedWorkDocumentModel, updateDocumentCustomPageMillimeters, DocumentUnderline, documentCommentDraftRange, documentParagraphTabStops, documentScriptFontSegments, documentUnderlineKeyboardShortcuts, documentParagraphIndent, documentFontNameFromCssFamily, DocumentScriptFontFormatting, canInsertDocumentComment, documentTableHorizontalAlignment, documentTextLayoutBatches, normalizeDocumentImageWrapSide, updateDocumentPageOrientation, documentCitationStyleDetails, validateDocumentBookmarkName, setCustomDocumentColumns, updateDocumentPageMarginMillimeters, documentCitationStyle, normalizeDocumentCharacterPositionHalfPoints, documentTransactionsOnlyHydrateChunks, normalizeDocumentKerningThresholdHalfPoints, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DOCUMENT_TABLE_STYLE_OPTIONS, updateDocumentColumnWidth, updateDocumentPaperSizePreset, documentPageMetrics, documentStrikeStyle, createDocumentBibliography, DocumentSubscript, DocumentParagraphIdentity, updateDocumentPageChromeVariant, updateDocumentMirrorMargins, activeDocumentTableStyle, normalizeDocumentScriptFontSlot, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, createWorkDocumentExtensions } from "./6282.js";
|
|
18
|
+
import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentScriptFontDirectFamily, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, patchDocumentScriptFonts, documentKerningThresholdPoints, nextDocumentTabAlignment, documentTableRowOptions, normalizedTabPosition, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, documentCitationCount, isDocumentParagraphArtBorderStyle, resolveDocumentPageBorders, documentLazyHtmlChunkFragment, DocumentFontFamily, normalizeDocumentHiddenText, documentLegacyTextEffectsConflict, DOCUMENT_CHUNK_VISIBLE_IDS_META, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, retainAnchoredDocumentComments, DocumentTableRowIdentity, work_document_page_margins_twipsToMillimeters, DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, resolveWorkDocumentEditorInput, documentCharacterPositionPoints, documentBulletListStyle, collectDocumentTextLayoutParagraphs, readOfficeDocumentCollaboration as readWorkOfficeDocumentCollaboration, normalizeDocumentCharacterScalePercent, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat, normalizeDocumentPageGeometry, normalizeDocumentImageLayer, documentImageProperties, isValidDocumentCitationTag, sanitizeDocumentPageChromeHtml, pageTwipsToMillimeters, normalizeDocumentPageBorders, parseDocumentScriptFonts, DocumentParagraphFormatting, activeDocumentSection, normalizeDocumentHtml, documentInitialSectionLayout, documentModelHasTrustedInitialIntegrityFeatures, documentParagraphDirection, documentParagraphPagination, documentModelUsesWindowing, documentPageChromeLegacyFields, documentChunkMountedIds, collectDocumentCommentAnchors, documentTextCaseKeyboardShortcuts, DocumentTextStyle, canChangeDocumentIndent, cssDocumentFontFamily, documentCharacterSpacingPoints, documentKerningIsEffective, DocumentSuperscript, documentSectionById, activeDocumentBookmark, DocumentEquation, documentLazyHtmlProjectionFingerprint, documentLazyHtmlProjection, normalizeDocumentParagraphIndent, updateDocumentGutterPosition, DocumentStrike, mountWorkLiveDocumentCapture, registerDocumentPageSurfaceGeometry, documentHiddenTextKeyboardShortcut, syncDocumentContentFromHtml, documentLegacyTextEffectsCss, documentScriptFontSlotFromHint, editorDocumentCaptionTargets, resolveDocumentPageChrome, documentScriptFontFamilyForRendering, documentImageLayoutOptions, MAX_DOCUMENT_NUMBERING_START, resolveDocumentPageSize, editorDocumentBookmarkReferenceTargets, serializeWorkDocumentNode, DOCUMENT_CHUNK_PAGINATION_META, createOfficeDocumentCollaborationBinding as createWorkOfficeDocumentCollaborationBinding, documentModelForContent, documentLegacyTextEffectsFromTextStyleAttributes, normalizeDocumentEmphasisMark, selectedDocumentChunkId, documentCommentViews, documentParagraphSpacing, normalizeDocumentTabStops, patchDocumentLazyHtmlProjection, normalizeDocumentTextCase, serializeDocumentScriptFonts, documentUnderlineColor, documentBookmarkNameExists, collectDocumentChanges, DocumentImage, resolveDocumentPageMargins, updateDocumentPageMarginMode, canSetDocumentTableRowRepeatHeader, normalizeDocumentCharacterSpacingTwips, DocumentCharacterFormatting, millimetersToPixels as work_document_layout_millimetersToPixels, DOCUMENT_CHUNK_HYDRATION_META, documentTabLeaderLabel, createSchemaDerivedWorkDocumentModel, updateDocumentCustomPageMillimeters, DocumentUnderline, documentCommentDraftRange, documentParagraphTabStops, documentScriptFontSegments, documentUnderlineKeyboardShortcuts, documentParagraphIndent, documentFontNameFromCssFamily, DocumentScriptFontFormatting, canInsertDocumentComment, documentTableHorizontalAlignment, documentTextLayoutBatches, normalizeDocumentImageWrapSide, updateDocumentPageOrientation, documentCitationStyleDetails, validateDocumentBookmarkName, setCustomDocumentColumns, updateDocumentPageMarginMillimeters, documentCitationStyle, normalizeDocumentCharacterPositionHalfPoints, documentTransactionsOnlyHydrateChunks, normalizeDocumentKerningThresholdHalfPoints, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DOCUMENT_TABLE_STYLE_OPTIONS, updateDocumentColumnWidth, updateDocumentPaperSizePreset, documentPageMetrics, documentStrikeStyle, createDocumentBibliography, DocumentSubscript, DocumentParagraphIdentity, updateDocumentPageChromeVariant, updateDocumentMirrorMargins, activeDocumentTableStyle, normalizeDocumentScriptFontSlot, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, normalizeDocumentLegacyTextEffect, createWorkDocumentExtensions } from "./6282.js";
|
|
19
19
|
import { useOfficeTaskPaneEscape, normalizeOfficeFontFamily, OfficeCheckbox, useOfficeDialog, useOfficeTaskPaneModal, CommittedOfficeNumberField, officeFontFamilyLabel, officeFontFamilies, CollectionState, createOfficeKernelClient, OfficeNumberField } from "./0~7048.js";
|
|
20
20
|
import { moveOfficeMenuFocus, office_text_field_OfficeTextArea, Popover, officeOverlayPortalRoot, button_Button, useOfficePublishPresenceLocation, OfficeTiptapPresenceLayer, icon_button_IconButton, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom, office_text_field_OfficeFileInput } from "./0~6090.js";
|
|
21
21
|
import { WorkOfficePreviewBar, isWorkspaceContextMenuKeyboardEvent, Tabs, WorkOfficeZoomControls, WorkOfficeStatusBar, Dialog, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkspaceContextMenu, WorkOfficeRibbonGroup, WorkOfficeRibbonButton } from "./0~4595.js";
|
|
@@ -9251,6 +9251,10 @@ function documentFontDialogSource(editor) {
|
|
|
9251
9251
|
const kerningValues = new Map();
|
|
9252
9252
|
const emphasisValues = new Map();
|
|
9253
9253
|
const hiddenTextValues = new Map();
|
|
9254
|
+
const legacyTextOutlineValues = new Map();
|
|
9255
|
+
const legacyTextShadowValues = new Map();
|
|
9256
|
+
const legacyTextEmbossValues = new Map();
|
|
9257
|
+
const legacyTextImprintValues = new Map();
|
|
9254
9258
|
const latinFontValues = new Map();
|
|
9255
9259
|
const eastAsiaFontValues = new Map();
|
|
9256
9260
|
const complexScriptFontValues = new Map();
|
|
@@ -9261,6 +9265,10 @@ function documentFontDialogSource(editor) {
|
|
|
9261
9265
|
addKerningValue(kerningValues, attributes.kerningThresholdHalfPoints);
|
|
9262
9266
|
addEmphasisValue(emphasisValues, attributes.emphasisMark);
|
|
9263
9267
|
addHiddenTextValue(hiddenTextValues, attributes.hiddenText);
|
|
9268
|
+
addLegacyTextEffectValue(legacyTextOutlineValues, attributes.legacyTextOutline);
|
|
9269
|
+
addLegacyTextEffectValue(legacyTextShadowValues, attributes.legacyTextShadow);
|
|
9270
|
+
addLegacyTextEffectValue(legacyTextEmbossValues, attributes.legacyTextEmboss);
|
|
9271
|
+
addLegacyTextEffectValue(legacyTextImprintValues, attributes.legacyTextImprint);
|
|
9264
9272
|
addDocumentScriptFontValues(latinFontValues, eastAsiaFontValues, complexScriptFontValues, attributes);
|
|
9265
9273
|
};
|
|
9266
9274
|
if (selection.empty) addValues(editor.getAttributes('textStyle'));
|
|
@@ -9269,13 +9277,17 @@ function documentFontDialogSource(editor) {
|
|
|
9269
9277
|
const textStyle = node.marks.find((mark)=>'textStyle' === mark.type.name);
|
|
9270
9278
|
addValues(textStyle?.attrs ?? {});
|
|
9271
9279
|
});
|
|
9272
|
-
if (!scaleValues.size || !spacingValues.size || !positionValues.size || !kerningValues.size || !emphasisValues.size || !hiddenTextValues.size || !latinFontValues.size || !eastAsiaFontValues.size || !complexScriptFontValues.size) addValues(editor.getAttributes('textStyle'));
|
|
9280
|
+
if (!scaleValues.size || !spacingValues.size || !positionValues.size || !kerningValues.size || !emphasisValues.size || !hiddenTextValues.size || !legacyTextOutlineValues.size || !legacyTextShadowValues.size || !legacyTextEmbossValues.size || !legacyTextImprintValues.size || !latinFontValues.size || !eastAsiaFontValues.size || !complexScriptFontValues.size) addValues(editor.getAttributes('textStyle'));
|
|
9273
9281
|
const characterScale = selectedValue(scaleValues);
|
|
9274
9282
|
const characterPosition = selectedValue(positionValues);
|
|
9275
9283
|
const characterSpacing = selectedValue(spacingValues);
|
|
9276
9284
|
const kerningThreshold = selectedValue(kerningValues);
|
|
9277
9285
|
const emphasisMark = selectedValue(emphasisValues);
|
|
9278
9286
|
const hiddenText = selectedValue(hiddenTextValues);
|
|
9287
|
+
const legacyTextOutline = selectedValue(legacyTextOutlineValues);
|
|
9288
|
+
const legacyTextShadow = selectedValue(legacyTextShadowValues);
|
|
9289
|
+
const legacyTextEmboss = selectedValue(legacyTextEmbossValues);
|
|
9290
|
+
const legacyTextImprint = selectedValue(legacyTextImprintValues);
|
|
9279
9291
|
const latinFont = selectedValue(latinFontValues);
|
|
9280
9292
|
const eastAsiaFont = selectedValue(eastAsiaFontValues);
|
|
9281
9293
|
const complexScriptFont = selectedValue(complexScriptFontValues);
|
|
@@ -9288,6 +9300,10 @@ function documentFontDialogSource(editor) {
|
|
|
9288
9300
|
kerningThreshold,
|
|
9289
9301
|
emphasisMark,
|
|
9290
9302
|
hiddenText,
|
|
9303
|
+
legacyTextOutline,
|
|
9304
|
+
legacyTextShadow,
|
|
9305
|
+
legacyTextEmboss,
|
|
9306
|
+
legacyTextImprint,
|
|
9291
9307
|
latinFont,
|
|
9292
9308
|
eastAsiaFont,
|
|
9293
9309
|
complexScriptFont,
|
|
@@ -9315,6 +9331,10 @@ function createDocumentFontDialogDraft(source) {
|
|
|
9315
9331
|
kerningThresholdPoints: formatPoints(documentKerningThresholdPoints(kerningThreshold) ?? 12),
|
|
9316
9332
|
emphasisMark: source.emphasisMark.mixed ? 'mixed' : source.emphasisMark.value ?? 'inherit',
|
|
9317
9333
|
hiddenText: source.hiddenText.value ?? false,
|
|
9334
|
+
legacyTextOutline: source.legacyTextOutline.value ?? false,
|
|
9335
|
+
legacyTextShadow: source.legacyTextShadow.value ?? false,
|
|
9336
|
+
legacyTextEmboss: source.legacyTextEmboss.value ?? false,
|
|
9337
|
+
legacyTextImprint: source.legacyTextImprint.value ?? false,
|
|
9318
9338
|
latinFont: documentFontFamilyDraftValue(source.latinFont),
|
|
9319
9339
|
eastAsiaFont: documentFontFamilyDraftValue(source.eastAsiaFont),
|
|
9320
9340
|
complexScriptFont: documentFontFamilyDraftValue(source.complexScriptFont)
|
|
@@ -9354,6 +9374,10 @@ function documentFontDialogPatch(source, draft, touched) {
|
|
|
9354
9374
|
}
|
|
9355
9375
|
}
|
|
9356
9376
|
if (touched.hiddenText && (source.hiddenText.mixed || source.hiddenText.value !== draft.hiddenText)) patch.hiddenText = draft.hiddenText;
|
|
9377
|
+
appendLegacyTextEffectPatch(patch, 'legacyTextOutline', source.legacyTextOutline, draft.legacyTextOutline, touched.legacyTextOutline);
|
|
9378
|
+
appendLegacyTextEffectPatch(patch, 'legacyTextShadow', source.legacyTextShadow, draft.legacyTextShadow, touched.legacyTextShadow);
|
|
9379
|
+
appendLegacyTextEffectPatch(patch, 'legacyTextEmboss', source.legacyTextEmboss, draft.legacyTextEmboss, touched.legacyTextEmboss);
|
|
9380
|
+
appendLegacyTextEffectPatch(patch, 'legacyTextImprint', source.legacyTextImprint, draft.legacyTextImprint, touched.legacyTextImprint);
|
|
9357
9381
|
appendDocumentFontDialogScriptFontPatch(patch, 'latinFont', source.latinFont, draft.latinFont, touched.latinFont);
|
|
9358
9382
|
appendDocumentFontDialogScriptFontPatch(patch, 'eastAsiaFont', source.eastAsiaFont, draft.eastAsiaFont, touched.eastAsiaFont);
|
|
9359
9383
|
appendDocumentFontDialogScriptFontPatch(patch, 'complexScriptFont', source.complexScriptFont, draft.complexScriptFont, touched.complexScriptFont);
|
|
@@ -9366,6 +9390,11 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
|
|
|
9366
9390
|
const hasKerning = void 0 !== patch.kerningThresholdHalfPoints;
|
|
9367
9391
|
const hasEmphasis = void 0 !== patch.emphasisMark;
|
|
9368
9392
|
const hasHiddenText = void 0 !== patch.hiddenText;
|
|
9393
|
+
const hasLegacyTextOutline = void 0 !== patch.legacyTextOutline;
|
|
9394
|
+
const hasLegacyTextShadow = void 0 !== patch.legacyTextShadow;
|
|
9395
|
+
const hasLegacyTextEmboss = void 0 !== patch.legacyTextEmboss;
|
|
9396
|
+
const hasLegacyTextImprint = void 0 !== patch.legacyTextImprint;
|
|
9397
|
+
const hasLegacyTextEffects = hasLegacyTextOutline || hasLegacyTextShadow || hasLegacyTextEmboss || hasLegacyTextImprint;
|
|
9369
9398
|
const scriptFontPatch = {
|
|
9370
9399
|
...void 0 !== patch.latinFont ? {
|
|
9371
9400
|
latin: patch.latinFont
|
|
@@ -9384,7 +9413,7 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
|
|
|
9384
9413
|
const kerningThreshold = hasKerning && null !== patch.kerningThresholdHalfPoints ? normalizeDocumentKerningThresholdHalfPoints(patch.kerningThresholdHalfPoints) : null;
|
|
9385
9414
|
const emphasisMark = hasEmphasis && null !== patch.emphasisMark ? normalizeDocumentEmphasisMark(patch.emphasisMark) : null;
|
|
9386
9415
|
const maximum = editor.state.doc.content.size;
|
|
9387
|
-
if (editor.isDestroyed || !hasScale && !hasPosition && !hasSpacing && !hasKerning && !hasEmphasis && !hasHiddenText && !hasScriptFonts || hasScale && null === scale || hasPosition && null === position || hasSpacing && null === spacing || hasKerning && null !== patch.kerningThresholdHalfPoints && null === kerningThreshold || hasEmphasis && null !== patch.emphasisMark && null === emphasisMark || hasHiddenText && 'boolean' != typeof patch.hiddenText || !Number.isSafeInteger(selection.from) || !Number.isSafeInteger(selection.to) || selection.from < 0 || selection.to < selection.from || selection.to > maximum) return false;
|
|
9416
|
+
if (editor.isDestroyed || !hasScale && !hasPosition && !hasSpacing && !hasKerning && !hasEmphasis && !hasHiddenText && !hasLegacyTextEffects && !hasScriptFonts || hasScale && null === scale || hasPosition && null === position || hasSpacing && null === spacing || hasKerning && null !== patch.kerningThresholdHalfPoints && null === kerningThreshold || hasEmphasis && null !== patch.emphasisMark && null === emphasisMark || hasHiddenText && 'boolean' != typeof patch.hiddenText || hasLegacyTextOutline && null === normalizeDocumentLegacyTextEffect(patch.legacyTextOutline) || hasLegacyTextShadow && null === normalizeDocumentLegacyTextEffect(patch.legacyTextShadow) || hasLegacyTextEmboss && null === normalizeDocumentLegacyTextEffect(patch.legacyTextEmboss) || hasLegacyTextImprint && null === normalizeDocumentLegacyTextEffect(patch.legacyTextImprint) || !Number.isSafeInteger(selection.from) || !Number.isSafeInteger(selection.to) || selection.from < 0 || selection.to < selection.from || selection.to > maximum || hasLegacyTextEffects && !documentFontDialogLegacyTextEffectsAreSafe(editor, selection, patch)) return false;
|
|
9388
9417
|
const attributes = {};
|
|
9389
9418
|
if (null !== scale) attributes.characterScalePercent = scale;
|
|
9390
9419
|
if (null !== position) attributes.characterPositionHalfPoints = position;
|
|
@@ -9392,6 +9421,10 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
|
|
|
9392
9421
|
if (hasKerning) attributes.kerningThresholdHalfPoints = kerningThreshold;
|
|
9393
9422
|
if (hasEmphasis) attributes.emphasisMark = emphasisMark;
|
|
9394
9423
|
if (hasHiddenText) attributes.hiddenText = patch.hiddenText ?? false;
|
|
9424
|
+
if (hasLegacyTextOutline) attributes.legacyTextOutline = patch.legacyTextOutline ?? false;
|
|
9425
|
+
if (hasLegacyTextShadow) attributes.legacyTextShadow = patch.legacyTextShadow ?? false;
|
|
9426
|
+
if (hasLegacyTextEmboss) attributes.legacyTextEmboss = patch.legacyTextEmboss ?? false;
|
|
9427
|
+
if (hasLegacyTextImprint) attributes.legacyTextImprint = patch.legacyTextImprint ?? false;
|
|
9395
9428
|
if (hasScriptFonts) return applyDocumentScriptFontPatch(editor, selection, attributes, scriptFontPatch);
|
|
9396
9429
|
return editor.chain().setTextSelection(selection).setMark('textStyle', attributes).removeEmptyTextStyle().focus().scrollIntoView().run();
|
|
9397
9430
|
}
|
|
@@ -9399,6 +9432,39 @@ function addScaleValue(values, value) {
|
|
|
9399
9432
|
const scale = normalizeDocumentCharacterScalePercent(value);
|
|
9400
9433
|
values.set(null === scale ? 'inherited' : String(scale), scale);
|
|
9401
9434
|
}
|
|
9435
|
+
function documentFontDialogLegacyTextEffectsAreSafe(editor, selection, patch) {
|
|
9436
|
+
const patchEffects = {
|
|
9437
|
+
...void 0 !== patch.legacyTextOutline ? {
|
|
9438
|
+
outline: patch.legacyTextOutline
|
|
9439
|
+
} : {},
|
|
9440
|
+
...void 0 !== patch.legacyTextShadow ? {
|
|
9441
|
+
shadow: patch.legacyTextShadow
|
|
9442
|
+
} : {},
|
|
9443
|
+
...void 0 !== patch.legacyTextEmboss ? {
|
|
9444
|
+
emboss: patch.legacyTextEmboss
|
|
9445
|
+
} : {},
|
|
9446
|
+
...void 0 !== patch.legacyTextImprint ? {
|
|
9447
|
+
imprint: patch.legacyTextImprint
|
|
9448
|
+
} : {}
|
|
9449
|
+
};
|
|
9450
|
+
const attributesAreSafe = (attributes)=>{
|
|
9451
|
+
const current = documentLegacyTextEffectsFromTextStyleAttributes(attributes);
|
|
9452
|
+
return null !== current && !documentLegacyTextEffectsConflict({
|
|
9453
|
+
...current,
|
|
9454
|
+
...patchEffects
|
|
9455
|
+
});
|
|
9456
|
+
};
|
|
9457
|
+
if (selection.from === selection.to) return attributesAreSafe(editor.getAttributes('textStyle'));
|
|
9458
|
+
let sawText = false;
|
|
9459
|
+
let safe = true;
|
|
9460
|
+
editor.state.doc.nodesBetween(selection.from, selection.to, (node, position)=>{
|
|
9461
|
+
if (!safe || !node.isText || position >= selection.to || position + node.nodeSize <= selection.from) return;
|
|
9462
|
+
sawText = true;
|
|
9463
|
+
const textStyle = node.marks.find((mark)=>'textStyle' === mark.type.name);
|
|
9464
|
+
safe = attributesAreSafe(textStyle?.attrs ?? {});
|
|
9465
|
+
});
|
|
9466
|
+
return safe && (sawText || attributesAreSafe(editor.getAttributes('textStyle')));
|
|
9467
|
+
}
|
|
9402
9468
|
function addPositionValue(values, value) {
|
|
9403
9469
|
const position = normalizeDocumentCharacterPositionHalfPoints(value);
|
|
9404
9470
|
values.set(null === position ? 'inherited' : String(position), position);
|
|
@@ -9419,6 +9485,13 @@ function addHiddenTextValue(values, value) {
|
|
|
9419
9485
|
const hiddenText = normalizeDocumentHiddenText(value);
|
|
9420
9486
|
values.set(null === hiddenText ? 'inherited' : String(hiddenText), hiddenText);
|
|
9421
9487
|
}
|
|
9488
|
+
function appendLegacyTextEffectPatch(patch, name, source, value, touched) {
|
|
9489
|
+
if (touched && (source.mixed || source.value !== value)) patch[name] = value;
|
|
9490
|
+
}
|
|
9491
|
+
function addLegacyTextEffectValue(values, value) {
|
|
9492
|
+
const effect = normalizeDocumentLegacyTextEffect(value);
|
|
9493
|
+
values.set(null === effect ? 'inherited' : String(effect), effect);
|
|
9494
|
+
}
|
|
9422
9495
|
function characterSpacingTwipsFromDraft(draft) {
|
|
9423
9496
|
if ('normal' === draft.characterSpacingMode) return 0;
|
|
9424
9497
|
if ('mixed' === draft.characterSpacingMode) return null;
|
|
@@ -9536,6 +9609,10 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9536
9609
|
const [kerningTouched, setKerningTouched] = useState(false);
|
|
9537
9610
|
const [emphasisTouched, setEmphasisTouched] = useState(false);
|
|
9538
9611
|
const [hiddenTextTouched, setHiddenTextTouched] = useState(false);
|
|
9612
|
+
const [legacyTextOutlineTouched, setLegacyTextOutlineTouched] = useState(false);
|
|
9613
|
+
const [legacyTextShadowTouched, setLegacyTextShadowTouched] = useState(false);
|
|
9614
|
+
const [legacyTextEmbossTouched, setLegacyTextEmbossTouched] = useState(false);
|
|
9615
|
+
const [legacyTextImprintTouched, setLegacyTextImprintTouched] = useState(false);
|
|
9539
9616
|
const [latinFontTouched, setLatinFontTouched] = useState(false);
|
|
9540
9617
|
const [eastAsiaFontTouched, setEastAsiaFontTouched] = useState(false);
|
|
9541
9618
|
const [complexScriptFontTouched, setComplexScriptFontTouched] = useState(false);
|
|
@@ -9549,6 +9626,10 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9549
9626
|
eastAsiaFont: eastAsiaFontTouched,
|
|
9550
9627
|
emphasisMark: emphasisTouched,
|
|
9551
9628
|
hiddenText: hiddenTextTouched,
|
|
9629
|
+
legacyTextOutline: legacyTextOutlineTouched,
|
|
9630
|
+
legacyTextShadow: legacyTextShadowTouched,
|
|
9631
|
+
legacyTextEmboss: legacyTextEmbossTouched,
|
|
9632
|
+
legacyTextImprint: legacyTextImprintTouched,
|
|
9552
9633
|
kerning: kerningTouched,
|
|
9553
9634
|
latinFont: latinFontTouched
|
|
9554
9635
|
});
|
|
@@ -9558,6 +9639,12 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9558
9639
|
const previewPosition = previewCharacterPosition(draft);
|
|
9559
9640
|
const previewKerning = previewDocumentKerning(draft, source.fontSize);
|
|
9560
9641
|
const previewEmphasis = previewDocumentEmphasis(draft.emphasisMark);
|
|
9642
|
+
const previewLegacyTextEffects = documentLegacyTextEffectsCss({
|
|
9643
|
+
outline: draft.legacyTextOutline,
|
|
9644
|
+
shadow: draft.legacyTextShadow,
|
|
9645
|
+
emboss: draft.legacyTextEmboss,
|
|
9646
|
+
imprint: draft.legacyTextImprint
|
|
9647
|
+
});
|
|
9561
9648
|
const submit = (event)=>{
|
|
9562
9649
|
event?.preventDefault();
|
|
9563
9650
|
if (!hasChanges || error) return;
|
|
@@ -9677,7 +9764,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9677
9764
|
className: "work-document-font-dialog-spacing",
|
|
9678
9765
|
children: [
|
|
9679
9766
|
/*#__PURE__*/ jsx("legend", {
|
|
9680
|
-
children: "
|
|
9767
|
+
children: "字符缩放、间距、字距调整、位置与文字效果"
|
|
9681
9768
|
}),
|
|
9682
9769
|
/*#__PURE__*/ jsxs("div", {
|
|
9683
9770
|
className: "work-document-font-dialog-field",
|
|
@@ -9899,6 +9986,104 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9899
9986
|
children: "隐藏文字"
|
|
9900
9987
|
})
|
|
9901
9988
|
}),
|
|
9989
|
+
/*#__PURE__*/ jsxs("fieldset", {
|
|
9990
|
+
className: "work-document-font-dialog-legacy-effects",
|
|
9991
|
+
"aria-label": "文字效果",
|
|
9992
|
+
children: [
|
|
9993
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
9994
|
+
ariaLabel: "空心",
|
|
9995
|
+
checked: draft.legacyTextOutline,
|
|
9996
|
+
indeterminate: source.legacyTextOutline.mixed && !legacyTextOutlineTouched,
|
|
9997
|
+
onCheckedChange: (legacyTextOutline)=>{
|
|
9998
|
+
setDraft((current)=>legacyTextOutline ? {
|
|
9999
|
+
...current,
|
|
10000
|
+
legacyTextOutline,
|
|
10001
|
+
legacyTextEmboss: false,
|
|
10002
|
+
legacyTextImprint: false
|
|
10003
|
+
} : {
|
|
10004
|
+
...current,
|
|
10005
|
+
legacyTextOutline
|
|
10006
|
+
});
|
|
10007
|
+
setLegacyTextOutlineTouched(true);
|
|
10008
|
+
if (legacyTextOutline) {
|
|
10009
|
+
setLegacyTextEmbossTouched(true);
|
|
10010
|
+
setLegacyTextImprintTouched(true);
|
|
10011
|
+
}
|
|
10012
|
+
},
|
|
10013
|
+
children: "空心"
|
|
10014
|
+
}),
|
|
10015
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
10016
|
+
ariaLabel: "阴影",
|
|
10017
|
+
checked: draft.legacyTextShadow,
|
|
10018
|
+
indeterminate: source.legacyTextShadow.mixed && !legacyTextShadowTouched,
|
|
10019
|
+
onCheckedChange: (legacyTextShadow)=>{
|
|
10020
|
+
setDraft((current)=>legacyTextShadow ? {
|
|
10021
|
+
...current,
|
|
10022
|
+
legacyTextShadow,
|
|
10023
|
+
legacyTextEmboss: false,
|
|
10024
|
+
legacyTextImprint: false
|
|
10025
|
+
} : {
|
|
10026
|
+
...current,
|
|
10027
|
+
legacyTextShadow
|
|
10028
|
+
});
|
|
10029
|
+
setLegacyTextShadowTouched(true);
|
|
10030
|
+
if (legacyTextShadow) {
|
|
10031
|
+
setLegacyTextEmbossTouched(true);
|
|
10032
|
+
setLegacyTextImprintTouched(true);
|
|
10033
|
+
}
|
|
10034
|
+
},
|
|
10035
|
+
children: "阴影"
|
|
10036
|
+
}),
|
|
10037
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
10038
|
+
ariaLabel: "阳文",
|
|
10039
|
+
checked: draft.legacyTextEmboss,
|
|
10040
|
+
indeterminate: source.legacyTextEmboss.mixed && !legacyTextEmbossTouched,
|
|
10041
|
+
onCheckedChange: (legacyTextEmboss)=>{
|
|
10042
|
+
setDraft((current)=>legacyTextEmboss ? {
|
|
10043
|
+
...current,
|
|
10044
|
+
legacyTextOutline: false,
|
|
10045
|
+
legacyTextShadow: false,
|
|
10046
|
+
legacyTextEmboss,
|
|
10047
|
+
legacyTextImprint: false
|
|
10048
|
+
} : {
|
|
10049
|
+
...current,
|
|
10050
|
+
legacyTextEmboss
|
|
10051
|
+
});
|
|
10052
|
+
setLegacyTextEmbossTouched(true);
|
|
10053
|
+
if (legacyTextEmboss) {
|
|
10054
|
+
setLegacyTextOutlineTouched(true);
|
|
10055
|
+
setLegacyTextShadowTouched(true);
|
|
10056
|
+
setLegacyTextImprintTouched(true);
|
|
10057
|
+
}
|
|
10058
|
+
},
|
|
10059
|
+
children: "阳文"
|
|
10060
|
+
}),
|
|
10061
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
10062
|
+
ariaLabel: "阴文",
|
|
10063
|
+
checked: draft.legacyTextImprint,
|
|
10064
|
+
indeterminate: source.legacyTextImprint.mixed && !legacyTextImprintTouched,
|
|
10065
|
+
onCheckedChange: (legacyTextImprint)=>{
|
|
10066
|
+
setDraft((current)=>legacyTextImprint ? {
|
|
10067
|
+
...current,
|
|
10068
|
+
legacyTextOutline: false,
|
|
10069
|
+
legacyTextShadow: false,
|
|
10070
|
+
legacyTextEmboss: false,
|
|
10071
|
+
legacyTextImprint
|
|
10072
|
+
} : {
|
|
10073
|
+
...current,
|
|
10074
|
+
legacyTextImprint
|
|
10075
|
+
});
|
|
10076
|
+
setLegacyTextImprintTouched(true);
|
|
10077
|
+
if (legacyTextImprint) {
|
|
10078
|
+
setLegacyTextOutlineTouched(true);
|
|
10079
|
+
setLegacyTextShadowTouched(true);
|
|
10080
|
+
setLegacyTextEmbossTouched(true);
|
|
10081
|
+
}
|
|
10082
|
+
},
|
|
10083
|
+
children: "阴文"
|
|
10084
|
+
})
|
|
10085
|
+
]
|
|
10086
|
+
}),
|
|
9902
10087
|
source.characterScale.mixed && !characterScaleTouched && /*#__PURE__*/ jsx("p", {
|
|
9903
10088
|
className: "work-document-font-dialog-mixed",
|
|
9904
10089
|
role: "status",
|
|
@@ -9929,7 +10114,12 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9929
10114
|
role: "status",
|
|
9930
10115
|
children: "当前选区同时包含隐藏和可见文字。勾选或取消后才会统一修改。"
|
|
9931
10116
|
}),
|
|
9932
|
-
(
|
|
10117
|
+
(source.legacyTextOutline.mixed && !legacyTextOutlineTouched || source.legacyTextShadow.mixed && !legacyTextShadowTouched || source.legacyTextEmboss.mixed && !legacyTextEmbossTouched || source.legacyTextImprint.mixed && !legacyTextImprintTouched) && /*#__PURE__*/ jsx("p", {
|
|
10118
|
+
className: "work-document-font-dialog-mixed",
|
|
10119
|
+
role: "status",
|
|
10120
|
+
children: "当前选区包含不同的空心、阴影、阳文或阴文设置。勾选或取消对应选项后才会统一修改。"
|
|
10121
|
+
}),
|
|
10122
|
+
(characterScaleTouched || characterSpacingTouched || characterPositionTouched || kerningTouched || emphasisTouched || hiddenTextTouched || legacyTextOutlineTouched || legacyTextShadowTouched || legacyTextEmbossTouched || legacyTextImprintTouched) && error && /*#__PURE__*/ jsx("p", {
|
|
9933
10123
|
className: "work-document-font-dialog-error",
|
|
9934
10124
|
role: "alert",
|
|
9935
10125
|
children: error
|
|
@@ -9955,6 +10145,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9955
10145
|
style: {
|
|
9956
10146
|
verticalAlign: `${previewPosition}pt`,
|
|
9957
10147
|
...previewEmphasis,
|
|
10148
|
+
...previewLegacyTextEffects,
|
|
9958
10149
|
...draft.hiddenText ? {
|
|
9959
10150
|
textDecorationColor: 'currentColor',
|
|
9960
10151
|
textDecorationLine: 'underline',
|
|
@@ -10032,7 +10223,7 @@ function previewScriptFontFamily(value, fallback) {
|
|
|
10032
10223
|
return 'mixed' === value || 'inherit' === value ? fallback ?? void 0 : value;
|
|
10033
10224
|
}
|
|
10034
10225
|
function fontDialogDescription(source) {
|
|
10035
|
-
return source.selectedCharacters ?
|
|
10226
|
+
return source.selectedCharacters ? `分别设置当前选中内容的拉丁、东亚和复杂文字字体,以及原生字符缩放、间距、字距调整阈值、位置、着重号、隐藏文字、空心、阴影、阳文和阴文(${source.selectedCharacters} 个字符)。` : '分别设置当前位置后续输入文字的拉丁、东亚和复杂文字字体,以及原生字符缩放、间距、字距调整阈值、位置、着重号、隐藏文字、空心、阴影、阳文和阴文。';
|
|
10036
10227
|
}
|
|
10037
10228
|
function DocumentPageChromeRibbon({ editor, editingPart, showPageNumber, onEditingPartChange, onTogglePageNumber, onOpenFontDialog, onClose }) {
|
|
10038
10229
|
const imageInputRef = useRef(null);
|