Import a Word document as a blog post, and add table blocks
- Table content blocks (migration 044): a grid of text, a row per line, cells split by |, the first row the header; cells take the same formatting as a paragraph; wide tables scroll on a phone - Blog posts -> Import from Word: the server reads the .docx (zip and XML read without a library, sizes capped) and creates an unpublished post through the CRUD engine: title, date, headings, paragraphs, lists, tables, bold, italic and links; the editor opens with a note of what came over and what didn't (images) - docs/importing.md, and an nginx block for the upload Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
adc88e5714
commit
7f12824c93
16 changed files with 656 additions and 6 deletions
|
|
@ -23,6 +23,8 @@ export const blogPosts = {
|
|||
singular: "blog post",
|
||||
idLabel: "URL ID",
|
||||
slugFrom: "title",
|
||||
// Blog posts → Import from Word (server/src/routes/import.js).
|
||||
importer: { label: "Import from Word", endpoint: "/admin/import/docx", accept: ".docx" },
|
||||
|
||||
list: {
|
||||
columns: [
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ export const BLOCK_TYPES = [
|
|||
["image", "Image", "A picture, with alt text and an optional caption and link."],
|
||||
["video", "Video", "A YouTube, Vimeo or Facebook video, or a video file, played in place."],
|
||||
["schedule", "Schedule", "Entries in one tab per day, each folding out for more. The text is an optional intro."],
|
||||
["table", "Table", "A grid of text, eg. a comparison chart: one row per line, cells split by |, the first row the header."],
|
||||
["divider", "Divider", "A thin line between parts."],
|
||||
];
|
||||
|
||||
|
|
@ -286,7 +287,7 @@ export const SCHEDULE_ENTRY = { scope: "parent", path: "type", value: "schedule"
|
|||
|
||||
export const blockTypeLabel = (type) => BLOCK_TYPES.find(([value]) => value === type)?.[1] ?? type;
|
||||
|
||||
export const TEXT_TYPES = ["paragraph", "heading", "subheading", "callout", "quote", "button", "image", "video", "schedule"];
|
||||
export const TEXT_TYPES = ["paragraph", "heading", "subheading", "callout", "quote", "button", "image", "video", "schedule", "table"];
|
||||
|
||||
export const TEXT_HELP = {
|
||||
paragraph: FORMATTING_HELP,
|
||||
|
|
@ -296,9 +297,12 @@ export const TEXT_HELP = {
|
|||
image: "Caption shown under the image. Optional.",
|
||||
video: "Caption shown under the video. Optional.",
|
||||
schedule: "Optional intro above the tabs. " + FORMATTING_HELP,
|
||||
table:
|
||||
"One row per line; cells split by |. The first row is the header. eg. Platform | Price | Best for. " +
|
||||
"Cells take the same formatting as a paragraph. A | inside a cell is written \|.",
|
||||
};
|
||||
|
||||
export const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption", schedule: "Intro" };
|
||||
export const TEXT_LABEL = { button: "Label", image: "Caption", video: "Caption", schedule: "Intro", table: "Rows" };
|
||||
|
||||
export const HREF_HELP = {
|
||||
paragraph: "Optional. Makes the whole paragraph one link. For a link inside the text, use [text](url).",
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export type ContentBlock = {
|
|||
| 'button'
|
||||
| 'callout'
|
||||
| 'schedule'
|
||||
| 'table'
|
||||
text?: string | null
|
||||
media?: string | null
|
||||
href?: string | null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue