From 117fa84cc48dadb409e2e17ecd5f3525b8ecc9c2 Mon Sep 17 00:00:00 2001 From: void Date: Fri, 26 Mar 2021 15:31:36 +0000 Subject: [PATCH] editor: WIP: --- app/assets/stylesheets/editor.scss | 2 +- app/javascript/editor/types/marks.ts | 1 + app/javascript/editor/utils.ts | 2 +- app/models/metadata_template.rb | 2 +- app/views/posts/attributes/_content.haml | 3 +++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/editor.scss b/app/assets/stylesheets/editor.scss index c7b50db4..5d218c7e 100644 --- a/app/assets/stylesheets/editor.scss +++ b/app/assets/stylesheets/editor.scss @@ -61,7 +61,7 @@ .editor-content { min-height: 480px; p, h1, h2, h3, h4, h5, h6, ul, li, figcaption { outline: #ccc solid thin; } - strong, em, del, u, sub, sup { background: #0002; } + strong, em, del, u, sub, sup, small { background: #0002; } a { background: #13fefe50; } [data-editor-selected] { outline: #f206f9 solid thick; } } diff --git a/app/javascript/editor/types/marks.ts b/app/javascript/editor/types/marks.ts index ac2493a8..3790c749 100644 --- a/app/javascript/editor/types/marks.ts +++ b/app/javascript/editor/types/marks.ts @@ -27,6 +27,7 @@ export const marks: { [propName: string]: EditorNode } = { super: makeMark('super', 'sup'), mark, link, + small: makeMark('small', 'small'), } function recursiveFilterSelection ( diff --git a/app/javascript/editor/utils.ts b/app/javascript/editor/utils.ts index fd3b0821..7ac4c186 100644 --- a/app/javascript/editor/utils.ts +++ b/app/javascript/editor/utils.ts @@ -1,7 +1,7 @@ import { Editor } from 'editor/editor' export const blockNames = ['paragraph', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'unordered_list', 'ordered_list'] -export const markNames = ['bold', 'italic', 'deleted', 'underline', 'sub', 'super', 'mark', 'link'] +export const markNames = ['bold', 'italic', 'deleted', 'underline', 'sub', 'super', 'mark', 'link', 'small'] export const parentBlockNames = ['left', 'center', 'right'] export function moveChildren (from: Element, to: Element, toRef: Node | null) { diff --git a/app/models/metadata_template.rb b/app/models/metadata_template.rb index c8ac0df7..3d3eeef7 100644 --- a/app/models/metadata_template.rb +++ b/app/models/metadata_template.rb @@ -178,7 +178,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, def allowed_tags @allowed_tags ||= %w[strong em del u mark p h1 h2 h3 h4 h5 h6 ul ol li img iframe audio video div figure - figcaption a].freeze + figcaption a small].freeze end # Decifra el valor diff --git a/app/views/posts/attributes/_content.haml b/app/views/posts/attributes/_content.haml index 50da7e9b..235dca30 100644 --- a/app/views/posts/attributes/_content.haml +++ b/app/views/posts/attributes/_content.haml @@ -47,6 +47,9 @@ %button.btn{ type: 'button', title: t('editor.sub'), data: { editor_button: 'mark-sub' } }> %i.fa.fa-fw.fa-subscript> %span.sr-only>= t('editor.sub') + %button.btn{ type: 'button', title: t('editor.small'), data: { editor_button: 'mark-small' } }> + %i.fa.fa-fw.fa-subscript> + %span.sr-only>= t('editor.small') %button.btn.mr-0{ type: 'button', title: t('editor.h1'), data: { editor_button: 'block-h1' } }> %i.fa.fa-fw.fa-heading> 1 diff --git a/config/locales/en.yml b/config/locales/en.yml index 4a843018..b657a156 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -584,6 +584,7 @@ en: link: Link super: Superscript sub: Subscript + small: Small h1: Heading 1 h2: Heading 2 h3: Heading 3 diff --git a/config/locales/es.yml b/config/locales/es.yml index 62c3f8ed..1893f4f1 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -596,6 +596,7 @@ es: mark: Resaltado super: Índice sub: Subíndice + small: Chico link: Vínculo h1: Título 1 h2: Título 2