marksmith 0.4.5 → 0.4.6.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/marksmith_controller-full.esm.js +12 -0
- data/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js +12 -0
- data/app/assets/stylesheets/marksmith.css +3 -0
- data/app/frontend/entrypoints/application.css +4 -0
- data/app/frontend/entrypoints/javascript/controllers/marksmith_controller.js +12 -0
- data/app/views/marksmith/shared/_action_bar.html.erb +1 -1
- data/app/views/marksmith/shared/_editor.html.erb +2 -2
- data/app/views/marksmith/shared/_editor_pane.html.erb +7 -7
- data/app/views/marksmith/shared/_loading_indicator.html.erb +3 -3
- data/app/views/marksmith/shared/_preview_pane.html.erb +1 -1
- data/app/views/marksmith/shared/_rendered_body.html.erb +1 -1
- data/app/views/marksmith/shared/_tabs.html.erb +3 -3
- data/app/views/marksmith/shared/_toolbar.html.erb +1 -1
- data/config/locales/marksmith.it.yml +17 -0
- data/config/locales/marksmith.pt-BR.yml +17 -0
- data/lib/marksmith/engine.rb +12 -1
- data/lib/marksmith/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66e5a656f6aee799a6a86a462e4038195049471d4e2aeb87f1b2a39fa59a1491
|
4
|
+
data.tar.gz: 4ac7fc23a4fbfb39d66a9b87ddf7ca867c53978679e40430af7be59a7c6d8c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ddf33a6225ac6bf02df90ca2d5c1a56c9fa491094a824a13daa1c6e1eec60078aa06ce737127a3fd71344c6e25c2603f7dfaddd09859f4e3f5fc2ba81c88a2
|
7
|
+
data.tar.gz: 4e0e087167042b65a1e827224c49dcdf12c15a7a51aaa843ca1833538d13c10bf5ccd62b5782af783e2d214d3724c5b015b16b6b539a3b7b5011dd960df093ed
|
@@ -3367,6 +3367,18 @@ var MarksmithController = (function () {
|
|
3367
3367
|
this.editor?.chain().focus().setAttachment(editorAttachments).run();
|
3368
3368
|
}
|
3369
3369
|
|
3370
|
+
indent(event) {
|
3371
|
+
event.preventDefault();
|
3372
|
+
// add a tab before the current cursor position
|
3373
|
+
const start = this.fieldElementTarget.selectionStart;
|
3374
|
+
const end = this.fieldElementTarget.selectionEnd;
|
3375
|
+
const text = this.fieldElementTarget.value;
|
3376
|
+
const newText = text.slice(0, start) + '\t' + text.slice(start, end) + text.slice(end);
|
3377
|
+
this.fieldElementTarget.value = newText;
|
3378
|
+
this.fieldElementTarget.selectionStart = start + 1;
|
3379
|
+
this.fieldElementTarget.selectionEnd = end + 1;
|
3380
|
+
}
|
3381
|
+
|
3370
3382
|
#uploadFiles(files) {
|
3371
3383
|
Array.from(files).forEach((file) => this.#uploadFile(file));
|
3372
3384
|
}
|
@@ -2877,6 +2877,18 @@ var MarksmithController = (function (stimulus) {
|
|
2877
2877
|
this.editor?.chain().focus().setAttachment(editorAttachments).run();
|
2878
2878
|
}
|
2879
2879
|
|
2880
|
+
indent(event) {
|
2881
|
+
event.preventDefault();
|
2882
|
+
// add a tab before the current cursor position
|
2883
|
+
const start = this.fieldElementTarget.selectionStart;
|
2884
|
+
const end = this.fieldElementTarget.selectionEnd;
|
2885
|
+
const text = this.fieldElementTarget.value;
|
2886
|
+
const newText = text.slice(0, start) + '\t' + text.slice(start, end) + text.slice(end);
|
2887
|
+
this.fieldElementTarget.value = newText;
|
2888
|
+
this.fieldElementTarget.selectionStart = start + 1;
|
2889
|
+
this.fieldElementTarget.selectionEnd = end + 1;
|
2890
|
+
}
|
2891
|
+
|
2880
2892
|
#uploadFiles(files) {
|
2881
2893
|
Array.from(files).forEach((file) => this.#uploadFile(file));
|
2882
2894
|
}
|
@@ -135,6 +135,18 @@ export default class extends Controller {
|
|
135
135
|
this.editor?.chain().focus().setAttachment(editorAttachments).run();
|
136
136
|
}
|
137
137
|
|
138
|
+
indent(event) {
|
139
|
+
event.preventDefault()
|
140
|
+
// add a tab before the current cursor position
|
141
|
+
const start = this.fieldElementTarget.selectionStart
|
142
|
+
const end = this.fieldElementTarget.selectionEnd
|
143
|
+
const text = this.fieldElementTarget.value
|
144
|
+
const newText = text.slice(0, start) + '\t' + text.slice(start, end) + text.slice(end)
|
145
|
+
this.fieldElementTarget.value = newText
|
146
|
+
this.fieldElementTarget.selectionStart = start + 1
|
147
|
+
this.fieldElementTarget.selectionEnd = end + 1
|
148
|
+
}
|
149
|
+
|
138
150
|
#uploadFiles(files) {
|
139
151
|
Array.from(files).forEach((file) => this.#uploadFile(file))
|
140
152
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= tag.markdown_toolbar for: textarea_id,
|
2
|
-
class: class_names("ms:flex ms:flex-wrap ms:px-2 ms:py-1", "ms:pointer-events-none": disabled),
|
2
|
+
class: class_names("marksmith-action-bar ms:flex ms:flex-wrap ms:px-2 ms:py-1", "ms:pointer-events-none": disabled),
|
3
3
|
data: { marksmith_target: "toolbar" } do
|
4
4
|
%>
|
5
5
|
<%= marksmith_toolbar_button "bold", hotkey: "Meta+b", hotkey_scope: textarea_id %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= content_tag :div,
|
2
2
|
id: editor.id,
|
3
|
-
class: "marksmith ms:block ms:flex-col ms:w-full ms:border ms:border-neutral-500 ms:rounded-md ms:@container ms:focus-within:outline-2 ms:outline-blue-500 ms:-outline-offset-1",
|
3
|
+
class: "marksmith-editor-wrapper marksmith ms:block ms:flex-col ms:w-full ms:border ms:border-neutral-500 ms:rounded-md ms:@container ms:focus-within:outline-2 ms:outline-blue-500 ms:-outline-offset-1",
|
4
4
|
data: {
|
5
5
|
controller: "marksmith list-continuation",
|
6
6
|
action: "
|
@@ -16,7 +16,7 @@
|
|
16
16
|
**editor.controller_data_attributes,
|
17
17
|
} do %>
|
18
18
|
<%= render partial: "marksmith/shared/toolbar", locals: { textarea_id: editor.textarea_id, disabled: editor.disabled} %>
|
19
|
-
<div class="ms:border-t ms:w-full ms:border-neutral-500 ms:flex ms:flex-1">
|
19
|
+
<div class="marksmith-editor-content ms:border-t ms:w-full ms:border-neutral-500 ms:flex ms:flex-1">
|
20
20
|
<%= render partial: "marksmith/shared/editor_pane", locals: { editor: } %>
|
21
21
|
<%= render partial: "marksmith/shared/preview_pane", locals: { editor: } %>
|
22
22
|
</div>
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<%= content_tag :div, class: "ms:flex ms:flex-1 ms:flex-col ms:size-full", data: { marksmith_target: "fieldContainer" } do %>
|
1
|
+
<%= content_tag :div, class: "marksmith-editor-pane ms:flex ms:flex-1 ms:flex-col ms:size-full", data: { marksmith_target: "fieldContainer" } do %>
|
2
2
|
<%= text_area_tag editor.field_name, editor.value,
|
3
3
|
id: editor.textarea_id,
|
4
4
|
class: class_names(
|
5
|
-
"ms:flex ms:flex-1 ms:border-none ms:resize-none ms:focus:outline-none ms:font-mono ms:focus:ring-0 ms:leading-normal ms:p-2 ms:text-sm ms:field-sizing-content ms:min-h-60",
|
5
|
+
"marksmith-textarea ms:flex ms:flex-1 ms:border-none ms:resize-none ms:focus:outline-none ms:font-mono ms:focus:ring-0 ms:leading-normal ms:p-2 ms:text-sm ms:field-sizing-content ms:min-h-60",
|
6
6
|
"ms:dark:bg-neutral-800 ms:dark:text-neutral-200",
|
7
7
|
editor.classes
|
8
8
|
),
|
9
9
|
data: {
|
10
|
-
action: "drop->marksmith#dropUpload paste->marksmith#pasteUpload",
|
10
|
+
action: "drop->marksmith#dropUpload paste->marksmith#pasteUpload keydown.tab->marksmith#indent",
|
11
11
|
marksmith_target: "fieldElement",
|
12
12
|
**editor.data_attributes
|
13
13
|
},
|
@@ -17,17 +17,17 @@
|
|
17
17
|
style: editor.style
|
18
18
|
%>
|
19
19
|
<% toolbar_button_classes = "ms:cursor-pointer ms:hover:bg-neutral-200 ms:px-1 ms:py-px ms:rounded ms:text-sm ms:dark:text-neutral-300 ms:dark:hover:bg-neutral-600" %>
|
20
|
-
<div class="ms:flex ms:flex-1 ms:flex-grow ms:space-x-2 ms:py-1 ms:border-t ms:border-neutral-500 ms:px-2 ms:font-sans ms:text-sm ms:p-2 ms:dark:bg-neutral-800 ms:dark:text-neutral-300 ms:rounded-b-md">
|
21
|
-
<%= link_to "https://docs.github.com/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax", target: "_blank", class: class_names("ms:flex ms:items-center ms:text-neutral-800 ms:no-underline ms:gap-1", toolbar_button_classes) do %>
|
20
|
+
<div class="marksmith-bottom-toolbar ms:flex ms:flex-1 ms:flex-grow ms:space-x-2 ms:py-1 ms:border-t ms:border-neutral-500 ms:px-2 ms:font-sans ms:text-sm ms:p-2 ms:dark:bg-neutral-800 ms:dark:text-neutral-300 ms:rounded-b-md">
|
21
|
+
<%= link_to "https://docs.github.com/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax", target: "_blank", class: class_names("marksmith-help-link ms:flex ms:items-center ms:text-neutral-800 ms:no-underline ms:gap-1", toolbar_button_classes) do %>
|
22
22
|
<%= marksmith_inline_svg("app/assets/images/marksmith/svgs/markdown.svg") %> <span><%= t("marksmith.markdown_is_supported").humanize %></span>
|
23
23
|
<% end %>
|
24
24
|
<% if editor.enable_file_uploads %>
|
25
|
-
<%= button_tag data: { action: "click->marksmith#buttonUpload" }, class: class_names("ms:bg-none ms:border-none ms:bg-transparent ms:text-neutral-600 ms:items-center ms:flex ms:gap-1", toolbar_button_classes) do %>
|
25
|
+
<%= button_tag data: { action: "click->marksmith#buttonUpload" }, class: class_names("marksmith-upload-button ms:bg-none ms:border-none ms:bg-transparent ms:text-neutral-600 ms:items-center ms:flex ms:gap-1", toolbar_button_classes) do %>
|
26
26
|
<%= marksmith_inline_svg("app/assets/images/marksmith/svgs/paperclip.svg") %> <span><%= t("marksmith.upload_files").humanize %></span>
|
27
27
|
<% end %>
|
28
28
|
<% end %>
|
29
29
|
<% if editor.gallery_enabled %>
|
30
|
-
<%= link_to editor.gallery_full_path, data: { turbo_frame: editor.gallery_turbo_frame }, class: class_names("ms:flex ms:items-center ms:text-neutral-800 ms:no-underline ms:gap-1", toolbar_button_classes) do %>
|
30
|
+
<%= link_to editor.gallery_full_path, data: { turbo_frame: editor.gallery_turbo_frame }, class: class_names("marksmith-gallery-link ms:flex ms:items-center ms:text-neutral-800 ms:no-underline ms:gap-1", toolbar_button_classes) do %>
|
31
31
|
<%= marksmith_inline_svg("app/assets/images/marksmith/svgs/gallery.svg") %> <span><%= t("marksmith.attach_from_gallery").humanize %></span>
|
32
32
|
<% end %>
|
33
33
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="ms:button-spinner">
|
2
|
-
<div class="double-bounce1"></div>
|
3
|
-
<div class="double-bounce2"></div>
|
1
|
+
<div class="marksmith-loading-indicator ms:button-spinner">
|
2
|
+
<div class="marksmith-loading-bounce1 double-bounce1"></div>
|
3
|
+
<div class="marksmith-loading-bounce2 double-bounce2"></div>
|
4
4
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= content_tag :div,
|
2
|
-
class: "ms:hidden ms:markdown-preview ms:size-full ms:flex-1 ms:flex ms:size-full ms:p-2 ms:overflow-auto ms:bg-white ms:dark:bg-neutral-800 ms:rounded-b-md",
|
2
|
+
class: "marksmith-preview-pane ms:hidden ms:markdown-preview ms:size-full ms:flex-1 ms:flex ms:size-full ms:p-2 ms:overflow-auto ms:bg-white ms:dark:bg-neutral-800 ms:rounded-b-md",
|
3
3
|
id: editor.preview_pane_id,
|
4
4
|
data: {
|
5
5
|
marksmith_target: "previewPane",
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%= content_tag :div, class: "ms:block ms:w-full ms:prose ms:max-w-none ms:prose-neutral ms:dark:prose-invert" do %>
|
1
|
+
<%= content_tag :div, class: "marksmith-rendered-body ms:block ms:w-full ms:prose ms:max-w-none ms:prose-neutral ms:dark:prose-invert" do %>
|
2
2
|
<%= sanitize(body, tags: %w(table th tr td span) + ActionView::Helpers::SanitizeHelper.sanitizer_vendor.safe_list_sanitizer.allowed_tags.to_a) %>
|
3
3
|
<% end %>
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<div class="ms:flex-1 ms:flex ms:items:center">
|
2
|
-
<button class="<%= marksmith_tab_classes %> active" data-action="click->marksmith#switchToWrite" data-marksmith-target="writeTabButton" type="button">
|
1
|
+
<div class="marksmith-tabs ms:flex-1 ms:flex ms:items:center">
|
2
|
+
<button class="marksmith-tab marksmith-write-tab <%= marksmith_tab_classes %> active" data-action="click->marksmith#switchToWrite" data-marksmith-target="writeTabButton" type="button">
|
3
3
|
<%= t('marksmith.write').humanize %>
|
4
4
|
</button>
|
5
|
-
<button class="<%= marksmith_tab_classes %>" data-action="click->marksmith#switchToPreview" data-marksmith-target="previewTabButton" type="button">
|
5
|
+
<button class="marksmith-tab marksmith-preview-tab <%= marksmith_tab_classes %>" data-action="click->marksmith#switchToPreview" data-marksmith-target="previewTabButton" type="button">
|
6
6
|
<%= t('marksmith.preview').humanize %>
|
7
7
|
</button>
|
8
8
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= tag.div class: class_names(
|
2
|
-
"ms:flex-1 ms:flex-col-reverse ms:@md:flex-row ms:grow ms:flex ms:justify-bewteen ms:bg-neutral-50 ms:rounded-t-md ms:gap-y-1",
|
2
|
+
"marksmith-toolbar ms:flex-1 ms:flex-col-reverse ms:@md:flex-row ms:grow ms:flex ms:justify-bewteen ms:bg-neutral-50 ms:rounded-t-md ms:gap-y-1",
|
3
3
|
"ms:dark:bg-neutral-700 ms:dark:text-neutral-200"
|
4
4
|
) do %>
|
5
5
|
<%= render partial: "marksmith/shared/tabs" %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
it:
|
2
|
+
marksmith:
|
3
|
+
attach_from_gallery: Allega dalla galleria
|
4
|
+
bold: grassetto
|
5
|
+
code: codice
|
6
|
+
header: intestazione
|
7
|
+
image: immagine
|
8
|
+
italic: corsivo
|
9
|
+
link: link
|
10
|
+
markdown_is_supported: Markdown è supportato
|
11
|
+
ordered_list: elenco ordinato
|
12
|
+
preview: anteprima
|
13
|
+
quote: citazione
|
14
|
+
task_list: elenco di attività
|
15
|
+
unordered_list: elenco non ordinato
|
16
|
+
upload_files: carica file
|
17
|
+
write: scrivi
|
@@ -0,0 +1,17 @@
|
|
1
|
+
pt-BR:
|
2
|
+
marksmith:
|
3
|
+
attach_from_gallery: Anexar da galeria
|
4
|
+
bold: negrito
|
5
|
+
code: código
|
6
|
+
header: cabeçalho
|
7
|
+
image: imagem
|
8
|
+
italic: itálico
|
9
|
+
link: link
|
10
|
+
markdown_is_supported: Markdown é suportado
|
11
|
+
ordered_list: lista ordenada
|
12
|
+
preview: pré-visualização
|
13
|
+
quote: citação
|
14
|
+
task_list: lista de tarefas
|
15
|
+
unordered_list: lista não ordenada
|
16
|
+
upload_files: enviar arquivos
|
17
|
+
write: escrever
|
data/lib/marksmith/engine.rb
CHANGED
@@ -9,7 +9,18 @@ module Marksmith
|
|
9
9
|
|
10
10
|
module FormBuilderExtensions
|
11
11
|
def marksmith(*args, **kwargs, &block)
|
12
|
-
|
12
|
+
# If the template has a 'marksmith_tag' method, use it to call the 'marksmith_tag' method
|
13
|
+
# ViewComponent has 'helpers' method, and from 4.0.0 we need to use it to call the 'marksmith_tag' method
|
14
|
+
# Otherwise, fallback to the template and raise error
|
15
|
+
marksmith_caller_object = if @template.respond_to?(:marksmith_tag)
|
16
|
+
@template
|
17
|
+
elsif @template.respond_to?(:helpers) && @template.helpers.respond_to?(:marksmith_tag)
|
18
|
+
@template.helpers
|
19
|
+
else
|
20
|
+
@template
|
21
|
+
end
|
22
|
+
|
23
|
+
marksmith_caller_object.marksmith_tag(*args, **kwargs.merge(form: self), &block)
|
13
24
|
end
|
14
25
|
end
|
15
26
|
|
data/lib/marksmith/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marksmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -84,6 +84,8 @@ files:
|
|
84
84
|
- app/views/marksmith/shared/_toolbar.html.erb
|
85
85
|
- config/locales/marksmith.de.yml
|
86
86
|
- config/locales/marksmith.en.yml
|
87
|
+
- config/locales/marksmith.it.yml
|
88
|
+
- config/locales/marksmith.pt-BR.yml
|
87
89
|
- config/routes.rb
|
88
90
|
- config/vite.json
|
89
91
|
- lib/generators/marksmith/install_generator.rb
|
@@ -101,7 +103,7 @@ metadata:
|
|
101
103
|
homepage_uri: https://github.com/avo-hq/marksmith
|
102
104
|
source_code_uri: https://github.com/avo-hq/marksmith
|
103
105
|
changelog_uri: https://github.com/avo-hq/marksmith/releases
|
104
|
-
post_install_message:
|
106
|
+
post_install_message:
|
105
107
|
rdoc_options: []
|
106
108
|
require_paths:
|
107
109
|
- lib
|
@@ -116,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
118
|
- !ruby/object:Gem::Version
|
117
119
|
version: '0'
|
118
120
|
requirements: []
|
119
|
-
rubygems_version: 3.5.
|
120
|
-
signing_key:
|
121
|
+
rubygems_version: 3.5.22
|
122
|
+
signing_key:
|
121
123
|
specification_version: 4
|
122
124
|
summary: Marksmith is a GitHub-style markdown editor for Ruby on Rails applications.
|
123
125
|
test_files: []
|