5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-05-19 09:40:48 +00:00

feat: soportar editor prosemirror con ui actual

This commit is contained in:
f 2022-10-24 14:42:24 -03:00
parent f448b4c7ee
commit e15191e242
9 changed files with 52 additions and 5 deletions

View file

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

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

@ -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",
"circular-dependency-plugin": "^5.2.2",
"commonmark": "^0.29.0",

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"