Skip to content

Feature idea: field picker panel based on JSON schema #47

@mihaistoie

Description

@mihaistoie

Hello,

The editor is wonderful — congratulations for the great work!

I am using docxtemplater to generate documents by merging JSON data with a DOCX template.
The data model is known, and for each model I already have a JSON Schema describing the data.

For example, for the "Personal" model I have this schema:

{
  "type": "object",
  "properties": {
    "firstName": {
      "type": "string",
      "title": "First name"
    },
    "lastName": {
      "type": "string",
      "title": "Last name"
    },
    "addresses": {
      "type": "array",
      "title": "Addresses",
      "items": {
        "type": "object",
        "properties": {
          "country": {
            "type": "string",
            "title": "Country"
          }
        }
      }
    }
  }
}

Example data:

{
  "firstName": "John",
  "lastName": "DOE",
  "addresses": [
    { "country": "USA" },
    { "country": "France" }
  ]
}

When creating a DOCX template I write:

First Name: {firstName}
Last Name: {lastName}
{#addresses}
{country}
{/addresses}

My idea

I would like to create a plugin that adds a panel listing the available fields (using the schema titles).

For example, instead of manually typing {firstName}, I would click in the panel on "First Name" and it would insert {firstName} at the cursor position.


Question

Do you think this is possible to implement as a plugin?
Do you have any advice or recommended approach for doing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions