Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for small-caps from google docs paste #1730

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./italic";
export * from "./link";
export * from "./list-item";
export * from "./list";
export * from "./small-caps";
export * from "./strikethrough";
export * from "./underline";
export * from "./vertical-adjust";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { InlineAnnotation } from "@atjson/document";

export class SmallCaps extends InlineAnnotation {
static vendorPrefix = "gdocs";
static type = "ts_sc"; // Text style: small caps
}
1 change: 1 addition & 0 deletions packages/@atjson/source-gdocs-paste/src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ GDocsSource.defineConverterTo(OffsetSource, (doc) => {
doc.where({ type: "-gdocs-ts_it" }).set({ type: "-offset-italic" });
doc.where({ type: "-gdocs-ts_un" }).set({ type: "-offset-underline" });
doc.where({ type: "-gdocs-ts_st" }).set({ type: "-offset-strikethrough" });
doc.where({ type: "-gdocs-ts_sc" }).set({ type: "-offset-small-caps" });
doc
.where({ type: "-gdocs-ts_va", attributes: { "-gdocs-va": "sub" } })
.set({ type: "-offset-subscript" })
Expand Down
2 changes: 1 addition & 1 deletion packages/@atjson/source-gdocs-paste/src/text-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function extractTextStyles(
delete state.ts_va;
}

for (let styleType of ["ts_bd", "ts_it", "ts_un", "ts_st"]) {
for (let styleType of ["ts_bd", "ts_it", "ts_un", "ts_st", "ts_sc"]) {
if (style[styleType] === true && !state[styleType]) {
state[styleType] = {
type: "-gdocs-" + styleType,
Expand Down
Loading
Loading