5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-10-06 22:46:57 +00:00

Merge branch 'usar-sutty-editor' into panel.sutty.nl

This commit is contained in:
f 2022-10-24 15:01:53 -03:00
commit 97010a387e
11 changed files with 54 additions and 7 deletions

View file

@ -505,3 +505,5 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1);
}
}
}
@import "new_editor";

View file

@ -1,4 +1,4 @@
.editor {
.old.editor {
box-sizing: border-box;
*, *::before, *::after { box-sizing: inherit; }

View file

@ -0,0 +1,16 @@
.new-editor {
.editor {
.menubar {
label.btn {
margin-bottom: 0.3rem !important;
}
.btn-group {
.btn {
margin-right: 0;
}
}
}
}
}

View file

@ -6,3 +6,4 @@ import './prosemirror'
import './timezone'
import './turbolinks-anchors'
import './validation'
import './new_editor'

View file

@ -0,0 +1,12 @@
import SuttyEditor from "@suttyweb/editor";
document.addEventListener("turbolinks:load", () => {
document.querySelectorAll(".new-editor").forEach((editorContainer) => {
new SuttyEditor({
target: editorContainer,
props: {
textareaEl: editorContainer.querySelector("textarea"),
},
});
});
});

View file

@ -0,0 +1,4 @@
# frozen_string_literal: true
# Testear el nuevo editor
class MetadataNewContent < MetadataContent; end

View file

@ -0,0 +1,3 @@
%tr{ id: attribute }
%th= post_label_t(attribute, post: post)
%td{ lang: locale, dir: dir }= metadata.value

View file

@ -3,7 +3,7 @@
= render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata
.editor{ id: attribute, data: { editor: '' } }
.old.editor{ id: attribute, data: { editor: '' } }
-# Esto es para luego decirle al navegador que se olvide estas cosas.
= hidden_field_tag 'storage_keys[]', "#{request.original_url}##{attribute}", data: { target: 'storage-key' }
.alert.alert-info

View file

@ -0,0 +1,9 @@
.form-group
= label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post)
= render 'posts/attribute_feedback',
post: post, attribute: attribute, metadata: metadata
.new-editor{ id: attribute }
= text_area_tag "#{base}[#{attribute}]", metadata.value.html_safe,
dir: dir, lang: locale,
**field_options(attribute, metadata), class: 'd-none'

View file

@ -12,7 +12,7 @@
"@rails/activestorage": "^6.1.3-1",
"@rails/ujs": "^6.1.3-1",
"@rails/webpacker": "5.2.1",
"@suttyweb/editor": "^0.1.0",
"@suttyweb/editor": "^0.1.2",
"babel-loader": "^8.2.2",
"chart.js": "^3.5.1",
"chartkick": "^4.0.5",

View file

@ -1171,10 +1171,10 @@
resolved "https://registry.yarnpkg.com/@stimulus/webpack-helpers/-/webpack-helpers-1.1.1.tgz#eff60cd4e58b921d1a2764dc5215f5141510f2c2"
integrity sha512-XOkqSw53N9072FLHvpLM25PIwy+ndkSSbnTtjKuyzsv8K5yfkFB2rv68jU1pzqYa9FZLcvZWP4yazC0V38dx9A==
"@suttyweb/editor@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.0.tgz#2dc451ceb7df39aaf2ab4c0372db177c4586014b"
integrity sha512-4P/lD3acOJM9iVo+c+OIf3yjA6NHuIVSNh782XfyDLGz8ZrJj7MEvpmJqiNHsqz7MT0gz5WHakM8GnU/C3bzXg==
"@suttyweb/editor@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@suttyweb/editor/-/editor-0.1.2.tgz#ff2798e993a78a55d334d7927d1e7c558203b483"
integrity sha512-OeMIB5KaqNo8XD2gJi5oDBlhkjWcPsSwxz3Ae2YaLp+cBuAZV2hWp7MoQpGGeWHjcgsE01fXR8TqL8B3KqBSig==
"@types/caseless@*":
version "0.12.2"