marksmith 0.0.12 → 0.0.15

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.
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.0.0 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.0.0-beta.10 | MIT License | https://tailwindcss.com */
2
2
  :root {
3
3
  --ms-font-sans: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
4
4
  'Segoe UI Symbol', 'Noto Color Emoji';
@@ -788,6 +788,9 @@
788
788
  margin-bottom: 0;
789
789
  }
790
790
  }
791
+ .ms\:block {
792
+ display: block;
793
+ }
791
794
  .ms\:flex {
792
795
  display: flex;
793
796
  }
@@ -923,6 +926,10 @@
923
926
  font-size: var(--ms-text-xs);
924
927
  line-height: var(--tw-leading, var(--ms-text-xs--line-height));
925
928
  }
929
+ .ms\:leading-normal {
930
+ --tw-leading: var(--ms-leading-normal);
931
+ line-height: var(--ms-leading-normal);
932
+ }
926
933
  .ms\:font-semibold {
927
934
  --tw-font-weight: var(--ms-font-weight-semibold);
928
935
  font-weight: var(--ms-font-weight-semibold);
@@ -1095,6 +1102,10 @@
1095
1102
  inherits: false;
1096
1103
  initial-value: solid;
1097
1104
  }
1105
+ @property --tw-leading {
1106
+ syntax: "*";
1107
+ inherits: false;
1108
+ }
1098
1109
  @property --tw-font-weight {
1099
1110
  syntax: "*";
1100
1111
  inherits: false;
@@ -0,0 +1,8 @@
1
+ <%= field_wrapper **field_wrapper_args, full_width: true do %>
2
+ <%= @form.marksmith @field.id,
3
+ extra_preview_params: {
4
+ resource_class: @resource.class.name,
5
+ field_id: field.id,
6
+ }
7
+ %>
8
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Marksmith::MarkdownField::EditComponent < Avo::Fields::EditComponent
4
+ end
@@ -0,0 +1,3 @@
1
+ <%= field_wrapper **field_wrapper_args, full_width: true do %>
2
+ <%= render partial: "marksmith/shared/rendered_body", locals: { body: Marksmith::Renderer.new.renderer.render(@field.value) } %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Marksmith::MarkdownField::ShowComponent < Avo::Fields::ShowComponent
4
+ end
@@ -15,7 +15,7 @@
15
15
  extra_preview_params = local_assigns[:extra_preview_params] || {}
16
16
  %>
17
17
  <%= content_tag :div,
18
- class: "ms:flex ms:flex-col ms:w-full ms:border ms:border-neutral-300 ms:rounded ms:@container ms:group ms:focus-within:border-neutral-400",
18
+ class: "ms:block ms:flex-col ms:w-full ms:border ms:border-neutral-300 ms:rounded ms:@container ms:focus-within:border-neutral-400",
19
19
  data: {
20
20
  controller: "marksmith list-continuation",
21
21
  action: "
@@ -52,11 +52,11 @@
52
52
  </markdown-toolbar>
53
53
  </div>
54
54
  <% toolbar_button_classes = "ms:cursor-pointer ms:hover:bg-neutral-100 ms:px-1 ms:py-px ms:rounded ms:text-sm" %>
55
- <div class="ms:border-t ms:border-neutral-300 ms:flex">
55
+ <div class="ms:border-t ms:w-full ms:border-neutral-300 ms:flex">
56
56
  <%= content_tag :div, class: "ms:flex ms:flex-col ms:size-full", data: { marksmith_target: "fieldContainer" } do %>
57
57
  <%= text_area_tag field_name, value,
58
58
  id: name,
59
- class: class_names("ms:flex ms:flex-1 ms:rounded ms:border-none ms:p-2 ms:resize-y ms:focus:outline-none ms:font-mono ms:focus:ring-0", classes),
59
+ class: class_names("ms:flex ms:flex-1 ms:rounded ms:border-none ms:p-2 ms:resize-y ms:focus:outline-none ms:font-mono ms:focus:ring-0 ms:leading-normal", classes),
60
60
  rows: rows,
61
61
  data: {
62
62
  action: "drop->marksmith#dropUpload paste->marksmith#pasteUpload",
@@ -68,7 +68,7 @@
68
68
  autofocus:,
69
69
  style:
70
70
  %>
71
- <div class="ms:flex ms:w-full ms:flex-1 ms:flex-grow ms:space-x-2 ms:py-1 ms:border-t ms:border-neutral-300 ms:px-2 ms:font-sans ms:text-sm">
71
+ <div class="ms:flex ms:flex-1 ms:flex-grow ms:space-x-2 ms:py-1 ms:border-t ms:border-neutral-300 ms:px-2 ms:font-sans ms:text-sm">
72
72
  <%= 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:gap-x-2 ms:text-neutral-800 ms:no-underline", toolbar_button_classes) do %>
73
73
  <%= image_tag asset_path("marksmith/svgs/markdown.svg"), class: "ms:inline ms:size-4" %> <%= t("marksmith.markdown_is_supported").humanize %>
74
74
  <% end %>
@@ -89,5 +89,4 @@
89
89
  </div>
90
90
  <% end %>
91
91
  </div>
92
- </div>
93
92
  <% end %>
@@ -19,8 +19,33 @@ module Marksmith
19
19
 
20
20
  initializer "marksmith.assets.precompile" do |app|
21
21
  if Rails.application.config.respond_to?(:assets)
22
+ # The manifest will expose the asset files to the main app.
22
23
  app.config.assets.precompile << "marksmith_manifest.js"
23
24
  end
24
25
  end
26
+
27
+ initializer "avo-markdown_field.init" do |app|
28
+ if defined?(Avo)
29
+ require "marksmith/fields/markdown_field"
30
+
31
+ app.routes.append do
32
+ mount Marksmith::Engine => "/marksmith"
33
+ end
34
+
35
+ ActiveSupport.on_load(:avo_boot) do
36
+ Avo.plugin_manager.register :marksmith_field
37
+
38
+ Avo.plugin_manager.register_field :markdown, Marksmith::Fields::MarkdownField
39
+ Avo.plugin_manager.register_field :marksmith, Marksmith::Fields::MarkdownField
40
+
41
+ Avo.asset_manager.add_stylesheet "marksmith"
42
+ Avo.asset_manager.add_javascript "marksmith_controller-no-stimulus.esm"
43
+ Avo.asset_manager.add_javascript "list_continuation_controller-no-stimulus.esm"
44
+
45
+ Avo.asset_manager.register_stimulus_controller "marksmith", "MarksmithController"
46
+ Avo.asset_manager.register_stimulus_controller "list-continuation", "ListContinuationController"
47
+ end
48
+ end
49
+ end
25
50
  end
26
51
  end
@@ -0,0 +1,15 @@
1
+ module Marksmith
2
+ module Fields
3
+ class MarkdownField < Avo::Fields::BaseField
4
+ def initialize(id, **args, &block)
5
+ super(id, **args, &block)
6
+
7
+ hide_on :index
8
+ end
9
+
10
+ def view_component_namespace
11
+ "Marksmith::MarkdownField"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Marksmith
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.15"
3
3
  end
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.0.12
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-23 00:00:00.000000000 Z
11
+ date: 2025-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -64,8 +64,16 @@ files:
64
64
  - app/assets/images/marksmith/svgs/quote.svg
65
65
  - app/assets/images/marksmith/svgs/task-list.svg
66
66
  - app/assets/images/marksmith/svgs/unordered-list.svg
67
+ - app/assets/javascripts/list_continuation_controller-full.esm.js
68
+ - app/assets/javascripts/list_continuation_controller-no-stimulus.esm.js
69
+ - app/assets/javascripts/marksmith_controller-full.esm.js
70
+ - app/assets/javascripts/marksmith_controller-no-stimulus.esm.js
67
71
  - app/assets/stylesheets/marksmith.css
68
72
  - app/assets/stylesheets/marksmith/application.css
73
+ - app/components/marksmith/markdown_field/edit_component.html.erb
74
+ - app/components/marksmith/markdown_field/edit_component.rb
75
+ - app/components/marksmith/markdown_field/show_component.html.erb
76
+ - app/components/marksmith/markdown_field/show_component.rb
69
77
  - app/controllers/marksmith/application_controller.rb
70
78
  - app/controllers/marksmith/markdown_previews_controller.rb
71
79
  - app/frontend/entrypoints/application.css
@@ -89,6 +97,7 @@ files:
89
97
  - config/vite.json
90
98
  - lib/marksmith.rb
91
99
  - lib/marksmith/engine.rb
100
+ - lib/marksmith/fields/markdown_field.rb
92
101
  - lib/marksmith/helper.rb
93
102
  - lib/marksmith/version.rb
94
103
  - lib/tasks/marksmith_tasks.rake