* fix: js

* fix
main
bokuweb 2022-03-16 12:54:17 +09:00 committed by GitHub
parent e243b5ce90
commit 8bc4e522aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 1 deletions

View File

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## docx-wasm@0.0.24y (16. March, 2022)
- Add js interface for `rStyle`.
## docx-wasm@0.0.246, docx-rs@0.3.4 (16. March, 2022) ## docx-wasm@0.0.246, docx-rs@0.3.4 (16. March, 2022)
- Support `rStyle`. - Support `rStyle`.

View File

@ -289,6 +289,10 @@ export class Docx {
} }
}); });
if (r.property.style) {
run = run.style(r.property.style);
}
if (typeof r.property.size !== "undefined") { if (typeof r.property.size !== "undefined") {
run = run.size(r.property.size); run = run.size(r.property.size);
} }

View File

@ -24,6 +24,7 @@ export type RunFontsJSON = {
}; };
export type RunPropertyJSON = { export type RunPropertyJSON = {
style?: string | null;
sz?: number | null; sz?: number | null;
szCs?: number | null; szCs?: number | null;
fonts?: RunFontsJSON | null; fonts?: RunFontsJSON | null;

View File

@ -28,6 +28,7 @@ export type RunPropertyIns = {
}; };
export type RunProperty = { export type RunProperty = {
style?: string;
size?: number; size?: number;
color?: string; color?: string;
highlight?: string; highlight?: string;
@ -164,6 +165,11 @@ export class Run {
return this; return this;
} }
style(style: string) {
this.property = { ...this.property, style };
return this;
}
size(size: number) { size(size: number) {
this.property = { ...this.property, size }; this.property = { ...this.property, size };
return this; return this;

View File

@ -1,6 +1,6 @@
{ {
"name": "docx-wasm", "name": "docx-wasm",
"version": "0.0.246", "version": "0.0.247",
"main": "dist/node/index.js", "main": "dist/node/index.js",
"browser": "dist/web/index.js", "browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>", "author": "bokuweb <bokuweb12@gmail.com>",

View File

@ -41,6 +41,11 @@ impl Run {
self self
} }
pub fn style(mut self, style: &str) -> Run {
self.0.run_property = self.0.run_property.style(style);
self
}
pub fn size(mut self, size: usize) -> Run { pub fn size(mut self, size: usize) -> Run {
self.0.run_property = self.0.run_property.size(size); self.0.run_property = self.0.run_property.size(size);
self self