From df619ffe49054a6007d039b3595b84afa51b37b5 Mon Sep 17 00:00:00 2001 From: Pulpgrinder Dev Team Date: Tue, 9 May 2023 11:01:54 -0800 Subject: [PATCH] Added style support for noProof option. Useful for blocks of source code, and possibly other things that cause the grammar and spelling checkers to go nuts. Example usage: run: { font:"Consolas", color: "0000AA", break:1, noProof:true, }, Also added section to .gitignore to exclude Mac .DS_Store files. These are useless on anything other than a Mac. --- .gitignore | 3 +++ src/file/paragraph/run/properties.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 287fdb8f83..2ec3d77b21 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ My Document.docx # Temporary folder tmp + +# Exclude Mac .DS_Store files +.DS_Store diff --git a/src/file/paragraph/run/properties.ts b/src/file/paragraph/run/properties.ts index 41ca650995..93ab96cfa4 100644 --- a/src/file/paragraph/run/properties.ts +++ b/src/file/paragraph/run/properties.ts @@ -1,3 +1,4 @@ +// https://www.ecma-international.org/wp-content/uploads/ECMA-376-1_5th_edition_december_2016.zip page 297, section 17.3.2.21 import { BorderElement, IBorderOptions } from "@file/border"; import { IShadingAttributesProperties, Shading } from "@file/shading"; import { ChangeAttributes, IChangedAttributesProperties } from "@file/track-revision/track-revision"; @@ -34,6 +35,7 @@ export enum TextEffect { } export interface IRunStylePropertiesOptions { + readonly noProof?: boolean; readonly bold?: boolean; readonly boldComplexScript?: boolean; readonly italics?: boolean; @@ -131,7 +133,9 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent { if (!options) { return; } - + if (options.noProof !== undefined) { + this.push(new OnOffElement("w:noProof", options.noProof)); + } if (options.bold !== undefined) { this.push(new OnOffElement("w:b", options.bold)); }