@tanglemedia/directus-collection-flex-editor
Version:
Creates the flex table and some basic related nodes like image, resource, embed, and section
55 lines (51 loc) • 999 B
JavaScript
export async function up(knex) {
const flexContentField = await knex("directus_fields")
.where({
collection: "tngl_flex_content",
field: "content",
})
.first();
// remove h1 tag from available choices of tools
if (flexContentField?.id) {
const currentOptions = flexContentField?.options;
const availableTools = [
"paragraph",
"codeBlock",
"h2",
"h3",
"h4",
"h5",
"h6",
"bold",
"italic",
"strike",
"code",
"subscript",
"superscript",
"link",
"removeLink",
"autolink",
"hardBreak",
"horizontalRule",
"textAlign",
"bulletList",
"orderedList",
"blockquote",
"table",
"undo",
"redo",
"fullscreen",
];
await knex("directus_fields")
.where({ id: flexContentField.id })
.update({
options: JSON.stringify({
...currentOptions,
tools: availableTools,
}),
});
}
}
export async function down(knex) {
// No need to revert the email message format change, so this is left empty.
}