diff --git a/Makefile b/Makefile index 66638fbb..b3eabaae 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,13 @@ dirs := $(patsubst %,root/%,data sites deploy public) $(dirs): mkdir -p $@ +app/assets/fonts/forkawesome-webfont.woff2: fa.txt + which glyphhanger || npm i -g glyphhanger + grep -v "^#" fa.txt | sed "s/^/U+/" | cut -d " " -f 1 | tr "\n" "," | xargs -rI {} glyphhanger --subset=node_modules/fork-awesome/fonts/forkawesome-webfont.ttf --formats=woff2 --whitelist="{}" + mv node_modules/fork-awesome/fonts/forkawesome-webfont-subset.woff2 $@ + +fa: app/assets/fonts/forkawesome-webfont.woff2 ## Fork Awesome + /etc/hosts: always @echo "Chequeando si es necesario agregar el dominio local $(SUTTY)" @grep -q " $(SUTTY)$$" $@ || echo -e "127.0.0.1 $(SUTTY)\n::1 $(SUTTY)" | sudo tee -a $@ diff --git a/app/assets/fonts/forkawesome-webfont.woff2 b/app/assets/fonts/forkawesome-webfont.woff2 new file mode 100644 index 00000000..e1cd6999 Binary files /dev/null and b/app/assets/fonts/forkawesome-webfont.woff2 differ diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 4c232fd6..9964dc4e 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -37,6 +37,7 @@ import "prosemirror-gapcursor/style/gapcursor.css" import "prosemirror-menu/style/menu.css" import "prosemirror-view/style/prosemirror.css" import "prosemirror-example-setup/style/style.css" +import "fork-awesome/scss/fork-awesome.scss" // Lista de equivalencias entre Date#getTimezoneOffset de JS y // MetadataEvent diff --git a/app/views/posts/attributes/_content.haml b/app/views/posts/attributes/_content.haml index e5718778..50da7e9b 100644 --- a/app/views/posts/attributes/_content.haml +++ b/app/views/posts/attributes/_content.haml @@ -13,52 +13,107 @@ dir: dir, lang: locale, **field_options(attribute, metadata), class: 'd-none' + -# + el > se come el salto de línea y hace que los botones no tengan + espacio adicional + + TODO: Eliminar todo el espacio en blanco para minificar HTML .editor-toolbar{ style: 'z-index: 1' } .editor-primary-toolbar.scrollbar-black - %button.btn{ type: 'button', data: { editor: { button: 'mark-bold' } } }= t('editor.bold') - %button.btn{ type: 'button', data: { editor: { button: 'mark-italic' } } }= t('editor.italic') - %button.btn{ type: 'button', data: { editor: { button: 'mark-deleted' } } }= t('editor.deleted') - %button.btn{ type: 'button', data: { editor: { button: 'mark-underline' } } }= t('editor.underline') - %button.btn{ type: 'button', data: { editor: { button: 'mark-super' } } }= t('editor.super') - %button.btn{ type: 'button', data: { editor: { button: 'mark-sub' } } }= t('editor.sub') - %button.btn{ type: 'button', data: { editor: { button: 'mark-mark' } } }= t('editor.mark') - %button.btn{ type: 'button', data: { editor: { button: 'mark-link' } } }= t('editor.link') - %button.btn{ type: 'button', data: { editor: { button: 'block-h1' } } }= t('editor.h1') - %button.btn{ type: 'button', data: { editor: { button: 'block-h2' } } }= t('editor.h2') - %button.btn{ type: 'button', data: { editor: { button: 'block-h3' } } }= t('editor.h3') - %button.btn{ type: 'button', data: { editor: { button: 'block-h4' } } }= t('editor.h4') - %button.btn{ type: 'button', data: { editor: { button: 'block-h5' } } }= t('editor.h5') - %button.btn{ type: 'button', data: { editor: { button: 'block-h6' } } }= t('editor.h6') - %button.btn{ type: 'button', data: { editor: { button: 'block-unordered_list' } } }= t('editor.ul') - %button.btn{ type: 'button', data: { editor: { button: 'block-ordered_list' } } }= t('editor.ol') - %button.btn{ type: 'button', data: { editor: { button: 'parentBlock-left' } } }= t('editor.left') - %button.btn{ type: 'button', data: { editor: { button: 'parentBlock-center' } } }= t('editor.center') - %button.btn{ type: 'button', data: { editor: { button: 'parentBlock-right' } } }= t('editor.right') - %button.btn{ type: 'button', data: { editor: { button: 'multimedia' } } }= t('editor.multimedia') + %button.btn{ type: 'button', title: t('editor.multimedia'), data: { editor_button: 'multimedia' } }> + %i.fa.fa-fw.fa-upload> + %span.sr-only>= t('editor.multimedia') + %button.btn{ type: 'button', title: t('editor.bold'), data: { editor_button: 'mark-bold' } }> + %i.fa.fa-fw.fa-bold> + %span.sr-only>= t('editor.bold') + %button.btn{ type: 'button', title: t('editor.italic'), data: { editor_button: 'mark-italic' } }> + %i.fa.fa-fw.fa-italic> + %span.sr-only>= t('editor.italic') + %button.btn{ type: 'button', title: t('editor.mark'), data: { editor_button: 'mark-mark' } }> + %i.fa.fa-fw.fa-tint> + %span.sr-only>= t('editor.mark') + %button.btn{ type: 'button', title: t('editor.link'), data: { editor_button: 'mark-link' } }> + %i.fa.fa-fw.fa-link> + %span.sr-only>= t('editor.link') + %button.btn{ type: 'button', title: t('editor.deleted'), data: { editor_button: 'mark-deleted' } }> + %i.fa.fa-fw.fa-strikethrough> + %span.sr-only>= t('editor.deleted') + %button.btn{ type: 'button', title: t('editor.underline'), data: { editor_button: 'mark-underline' } }> + %i.fa.fa-fw.fa-underline> + %span.sr-only>= t('editor.underline') + %button.btn{ type: 'button', title: t('editor.super'), data: { editor_button: 'mark-super' } }> + %i.fa.fa-fw.fa-superscript> + %span.sr-only>= t('editor.super') + %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.mr-0{ type: 'button', title: t('editor.h1'), data: { editor_button: 'block-h1' } }> + %i.fa.fa-fw.fa-heading> + 1 + %span.sr-only>= t('editor.h1') + %details.d-inline> + %summary.d-inline> + %span.btn.ml-0{ role: 'button', title: t('editor.more') }> + %i.fa.fa-caret-right> + %span.sr-only= t('editor.more') + .d-inline> + %button.btn{ type: 'button', title: t('editor.h2'), data: { editor_button: 'block-h2' } }> + %i.fa.fa-fw.fa-heading> + 2 + %span.sr-only>= t('editor.h2') + %button.btn{ type: 'button', title: t('editor.h3'), data: { editor_button: 'block-h3' } }> + %i.fa.fa-fw.fa-heading> + 3 + %span.sr-only>= t('editor.h3') + %button.btn{ type: 'button', title: t('editor.h4'), data: { editor_button: 'block-h4' } }> + %i.fa.fa-fw.fa-heading> + 4 + %span.sr-only>= t('editor.h4') + %button.btn{ type: 'button', title: t('editor.h5'), data: { editor_button: 'block-h5' } }> + %i.fa.fa-fw.fa-heading> + 5 + %span.sr-only>= t('editor.h5') + %button.btn{ type: 'button', title: t('editor.h6'), data: { editor_button: 'block-h6' } }> + %i.fa.fa-fw.fa-heading> + 6 + %span.sr-only>= t('editor.h6') + %button.btn{ type: 'button', title: t('editor.ul'), data: { editor_button: 'block-unordered_list' } }> + %i.fa.fa-fw.fa-list-ul> + %span.sr-only>= t('editor.ul') + %button.btn{ type: 'button', title: t('editor.ol'), data: { editor_button: 'block-ordered_list' } }> + %i.fa.fa-fw.fa-list-ol> + %span.sr-only>= t('editor.ol') + %button.btn{ type: 'button', title: t('editor.left'), data: { editor_button: 'parentBlock-left' } }> + %i.fa.fa-fw.fa-align-left> + %span.sr-only>= t('editor.left') + %button.btn{ type: 'button', title: t('editor.center'), data: { editor_button: 'parentBlock-center' } }> + %i.fa.fa-fw.fa-align-center> + %span.sr-only>= t('editor.center') + %button.btn{ type: 'button', title: t('editor.right'), data: { editor_button: 'parentBlock-right' } }> + %i.fa.fa-fw.fa-align-right> + %span.sr-only>= t('editor.right') - -# - HAML cringe - TODO: generar IDs para labels - .editor-auxiliary-toolbar.mt-1.scrollbar-black{ data: { 'editor_auxiliary_toolbar': '' } } - .form-group{ data: { editor: { auxiliary: 'mark' } } } + -# HAML cringe + .editor-auxiliary-toolbar.mt-1.scrollbar-black{ data: { editor_auxiliary_toolbar: '' } } + .form-group{ data: { editor_auxiliary: 'mark' } } %label{ for: 'mark-color' }= t('editor.color') %input.form-control{ type: 'color', name: 'mark-color' }/ - %div{ data: { editor: { auxiliary: 'multimedia' } } } + %div{ data: { editor_auxiliary: 'multimedia' } } .form-group .custom-file - %input.custom-file-input{ type: 'file', name: 'multimedia-file' }/ + %input.custom-file-input{ type: 'file', id: 'multimedia-file', name: 'multimedia-file' }/ %label.custom-file-label{ for: 'multimedia-file' }= t('editor.multimedia-select') .form-group %label{ for: 'multimedia-alt' }= t('editor.description') - %input.form-control{ type: 'text', name: 'multimedia-alt' }/ + %input.form-control{ type: 'text', id: 'multimedia-alt', name: 'multimedia-alt' }/ .form-group - %button.btn{ type: 'button', name: 'multimedia-file-upload' }= t('editor.multimedia-upload') - %button.btn{ type: 'button', name: 'multimedia-remove' }= t('editor.multimedia-remove') + %button.btn{ type: 'button', id: 'multimedia-file-upload', name: 'multimedia-file-upload' }= t('editor.multimedia-upload') + %button.btn{ type: 'button', id: 'multimedia-remove', name: 'multimedia-remove' }= t('editor.multimedia-remove') - .form-group{ data: { editor: { auxiliary: 'link' } } } + .form-group{ data: { editor_auxiliary: 'link' } } %label{ for: 'link-url' }= t('editor.url') - %input.form-control{ type: 'url', name: 'link-url' }/ + %input.form-control{ type: 'url', id: 'link-url', name: 'link-url' }/ .editor-aviso-word.alert.alert-info %p= t('editor.word') diff --git a/config/locales/en.yml b/config/locales/en.yml index 6e050249..c66697eb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -582,7 +582,7 @@ en: underline: Underline mark: Mark link: Link - sup: Superscript + super: Superscript sub: Subscript h1: Heading 1 h2: Heading 2 @@ -602,4 +602,5 @@ en: multimedia-remove: Remove media description: Description for blind people and search engines url: Address + more: More heading levels word: "If you're pasting from an hegemonic word processor, please be patient with us, it's not always simple to recover the whole format :)" diff --git a/config/locales/es.yml b/config/locales/es.yml index 309b40ea..637a8f92 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -594,7 +594,7 @@ es: deleted: Tachado underline: Subrayado mark: Resaltado - sup: Índice + super: Índice sub: Subíndice link: Vínculo h1: Título 1 @@ -615,4 +615,5 @@ es: multimedia-remove: Borrar multimedia description: Descripción para personas no videntes y buscadores url: Dirección + more: Más niveles de título word: "Si estás pegando texto desde un hegemónico editor de texto que empieza con W, por favor tenenos paciencia, no siempre es simple recuperar y respetar todo el formato :)" diff --git a/fa.txt b/fa.txt new file mode 100644 index 00000000..29f6d805 --- /dev/null +++ b/fa.txt @@ -0,0 +1,17 @@ +f037 align-center +f036 align-left +f038 align-right +f032 bold +f033 italic +f0cb list-ol +f0ca list-ul +f0cd underline +f0c1 link +f043 tint +f1dc heading +f12c subscript +f12b superscript +f0cc strikethrough +f093 upload +f10d quote-left +f0da caret-right diff --git a/package.json b/package.json index 691fb33d..7ef6368b 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "devDependencies": { "@babel/preset-typescript": "^7.12.13", "circular-dependency-plugin": "^5.2.2", + "fork-awesome": "^1.1.7", "fork-ts-checker-webpack-plugin": "^6.1.0", "typescript": "^4.1.5", "webpack-dev-server": "^3.11.0" diff --git a/yarn.lock b/yarn.lock index 30f3ce19..55c5b967 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3207,6 +3207,11 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +fork-awesome@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/fork-awesome/-/fork-awesome-1.1.7.tgz#1427da1cac3d1713046ee88427e5fcecb9501d21" + integrity sha512-IHI7XCSXrKfUIWslse8c/PaaVDT1oBaYge+ju40ihL2ooiQeBpTr4wvIXhgTd2NuhntlvX+M5jYHAPTzNlmv0g== + fork-ts-checker-webpack-plugin@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-6.1.0.tgz#7581a6ccd7cbbed9ecce3de64fb1f599d7a2990b"