activeadmin_mitosis_editor 0.1.0
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 +7 -0
- data/CHANGELOG.md +17 -0
- data/CLAUDE.md +118 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +126 -0
- data/RELEASE.md +80 -0
- data/Rakefile +2 -0
- data/activeadmin_mitosis_editor.gemspec +17 -0
- data/app/views/inputs/mitosis_editor_input/_dependencies.html.erb +9 -0
- data/app/views/inputs/mitosis_editor_input/_form.html.erb +52 -0
- data/bin/console +5 -0
- data/bin/setup +14 -0
- data/demo/.dockerignore +51 -0
- data/demo/.gitattributes +9 -0
- data/demo/.gitignore +37 -0
- data/demo/.kamal/hooks/docker-setup.sample +3 -0
- data/demo/.kamal/hooks/post-app-boot.sample +3 -0
- data/demo/.kamal/hooks/post-deploy.sample +14 -0
- data/demo/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/demo/.kamal/hooks/pre-app-boot.sample +3 -0
- data/demo/.kamal/hooks/pre-build.sample +51 -0
- data/demo/.kamal/hooks/pre-connect.sample +47 -0
- data/demo/.kamal/hooks/pre-deploy.sample +122 -0
- data/demo/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/demo/.kamal/secrets +20 -0
- data/demo/.rubocop.yml +8 -0
- data/demo/.ruby-version +1 -0
- data/demo/Dockerfile +76 -0
- data/demo/Gemfile +78 -0
- data/demo/Procfile.dev +2 -0
- data/demo/README.md +24 -0
- data/demo/Rakefile +6 -0
- data/demo/app/admin/articles.rb +12 -0
- data/demo/app/admin/dashboard.rb +17 -0
- data/demo/app/admin/pages.rb +12 -0
- data/demo/app/admin/posts.rb +12 -0
- data/demo/app/assets/builds/.keep +0 -0
- data/demo/app/assets/builds/active_admin.css +3852 -0
- data/demo/app/assets/images/.keep +0 -0
- data/demo/app/assets/stylesheets/active_admin.css +3 -0
- data/demo/app/assets/stylesheets/application.css +1 -0
- data/demo/app/assets/stylesheets/mitosis-editor.css +1 -0
- data/demo/app/assets/stylesheets/theme-dark.css +1 -0
- data/demo/app/assets/stylesheets/theme-light.css +1 -0
- data/demo/app/controllers/application_controller.rb +7 -0
- data/demo/app/controllers/articles_controller.rb +7 -0
- data/demo/app/controllers/concerns/.keep +0 -0
- data/demo/app/helpers/application_helper.rb +2 -0
- data/demo/app/helpers/articles_helper.rb +2 -0
- data/demo/app/javascript/application.js +3 -0
- data/demo/app/javascript/controllers/application.js +9 -0
- data/demo/app/javascript/controllers/hello_controller.js +7 -0
- data/demo/app/javascript/controllers/index.js +4 -0
- data/demo/app/jobs/application_job.rb +7 -0
- data/demo/app/mailers/application_mailer.rb +4 -0
- data/demo/app/models/application_record.rb +3 -0
- data/demo/app/models/article.rb +5 -0
- data/demo/app/models/concerns/.keep +0 -0
- data/demo/app/models/page.rb +5 -0
- data/demo/app/models/post.rb +5 -0
- data/demo/app/views/articles/_article.html.erb +12 -0
- data/demo/app/views/articles/_article.json.jbuilder +2 -0
- data/demo/app/views/articles/_form.html.erb +27 -0
- data/demo/app/views/articles/edit.html.erb +12 -0
- data/demo/app/views/articles/index.html.erb +16 -0
- data/demo/app/views/articles/index.json.jbuilder +1 -0
- data/demo/app/views/articles/new.html.erb +11 -0
- data/demo/app/views/articles/show.html.erb +10 -0
- data/demo/app/views/articles/show.json.jbuilder +1 -0
- data/demo/app/views/inputs/mitosis_editor_input/_dependencies.html.erb +17 -0
- data/demo/app/views/layouts/application.html.erb +29 -0
- data/demo/app/views/layouts/mailer.html.erb +13 -0
- data/demo/app/views/layouts/mailer.text.erb +1 -0
- data/demo/app/views/pwa/manifest.json.erb +22 -0
- data/demo/app/views/pwa/service-worker.js +26 -0
- data/demo/bin/brakeman +7 -0
- data/demo/bin/bundler-audit +6 -0
- data/demo/bin/ci +6 -0
- data/demo/bin/dev +8 -0
- data/demo/bin/docker-entrypoint +8 -0
- data/demo/bin/importmap +4 -0
- data/demo/bin/jobs +6 -0
- data/demo/bin/kamal +27 -0
- data/demo/bin/rails +4 -0
- data/demo/bin/rake +4 -0
- data/demo/bin/rubocop +8 -0
- data/demo/bin/setup +35 -0
- data/demo/bin/thrust +5 -0
- data/demo/config/application.rb +27 -0
- data/demo/config/boot.rb +4 -0
- data/demo/config/bundler-audit.yml +5 -0
- data/demo/config/cable.yml +17 -0
- data/demo/config/cache.yml +16 -0
- data/demo/config/ci.rb +23 -0
- data/demo/config/credentials.yml.enc +1 -0
- data/demo/config/database.yml +41 -0
- data/demo/config/deploy.yml +120 -0
- data/demo/config/environment.rb +21 -0
- data/demo/config/environments/development.rb +78 -0
- data/demo/config/environments/production.rb +90 -0
- data/demo/config/environments/test.rb +53 -0
- data/demo/config/importmap.rb +7 -0
- data/demo/config/initializers/active_admin.rb +275 -0
- data/demo/config/initializers/activeadmin_mitosis_editor.rb +19 -0
- data/demo/config/initializers/assets.rb +7 -0
- data/demo/config/initializers/content_security_policy.rb +29 -0
- data/demo/config/initializers/filter_parameter_logging.rb +8 -0
- data/demo/config/initializers/inflections.rb +16 -0
- data/demo/config/locales/en.yml +31 -0
- data/demo/config/puma.rb +42 -0
- data/demo/config/queue.yml +18 -0
- data/demo/config/recurring.yml +15 -0
- data/demo/config/routes.rb +16 -0
- data/demo/config/storage.yml +27 -0
- data/demo/config.ru +6 -0
- data/demo/db/cable_schema.rb +11 -0
- data/demo/db/cache_schema.rb +12 -0
- data/demo/db/migrate/20260215110410_create_active_admin_comments.rb +16 -0
- data/demo/db/migrate/20260215110416_create_articles.rb +10 -0
- data/demo/db/migrate/20260216124916_create_posts.rb +10 -0
- data/demo/db/migrate/20260216124919_create_pages.rb +10 -0
- data/demo/db/queue_schema.rb +129 -0
- data/demo/db/schema.rb +48 -0
- data/demo/db/seeds.rb +9 -0
- data/demo/lib/tasks/.keep +0 -0
- data/demo/log/.keep +0 -0
- data/demo/package-lock.json +1260 -0
- data/demo/package.json +13 -0
- data/demo/public/400.html +135 -0
- data/demo/public/404.html +135 -0
- data/demo/public/406-unsupported-browser.html +135 -0
- data/demo/public/422.html +135 -0
- data/demo/public/500.html +135 -0
- data/demo/public/icon.png +0 -0
- data/demo/public/icon.svg +3 -0
- data/demo/public/robots.txt +1 -0
- data/demo/script/.keep +0 -0
- data/demo/spec/rails_helper.rb +72 -0
- data/demo/spec/spec_helper.rb +94 -0
- data/demo/spec/system/admin_articles_spec.rb +22 -0
- data/demo/spec/system/mitosis_editor_prism_spec.rb +34 -0
- data/demo/spec/system/mitosis_editor_theme_spec.rb +63 -0
- data/demo/storage/.keep +0 -0
- data/demo/tailwind-active_admin.config.js +17 -0
- data/demo/tmp/.keep +0 -0
- data/demo/tmp/storage/.keep +0 -0
- data/demo/vendor/.keep +0 -0
- data/demo/vendor/javascript/.keep +0 -0
- data/docs/plans/2026-02-15-mitosis-editor-gem-design.md +70 -0
- data/docs/plans/2026-02-15-mitosis-editor-gem-implementation.md +407 -0
- data/lib/activeadmin_mitosis_editor/inputs/mitosis_editor_input.rb +29 -0
- data/lib/activeadmin_mitosis_editor/railtie.rb +7 -0
- data/lib/activeadmin_mitosis_editor/version.rb +3 -0
- data/lib/activeadmin_mitosis_editor.rb +13 -0
- data/lib/generators/mitosis_editor/styles_generator.rb +23 -0
- data/lib/generators/mitosis_editor/templates/_dependencies.html.erb +17 -0
- data/lib/generators/mitosis_editor/views_generator.rb +14 -0
- data/preview.png +0 -0
- data/script/bump-version +78 -0
- data/vendor/assets/javascripts/mitosis-editor.js +61 -0
- data/vendor/assets/stylesheets/mitosis-editor.css +1 -0
- data/vendor/assets/stylesheets/theme-dark.min.css +1 -0
- data/vendor/assets/stylesheets/theme-light.min.css +1 -0
- metadata +248 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
|
|
7
|
+
<title>We're sorry, but something went wrong (500 Internal Server Error)</title>
|
|
8
|
+
|
|
9
|
+
<meta charset="utf-8">
|
|
10
|
+
<meta name="viewport" content="initial-scale=1, width=device-width">
|
|
11
|
+
<meta name="robots" content="noindex, nofollow">
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
|
|
15
|
+
*, *::before, *::after {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
* {
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
html {
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
body {
|
|
28
|
+
background: #FFF;
|
|
29
|
+
color: #261B23;
|
|
30
|
+
display: grid;
|
|
31
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
32
|
+
font-size: clamp(1rem, 2.5vw, 2rem);
|
|
33
|
+
-webkit-font-smoothing: antialiased;
|
|
34
|
+
font-style: normal;
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
letter-spacing: -0.0025em;
|
|
37
|
+
line-height: 1.4;
|
|
38
|
+
min-height: 100dvh;
|
|
39
|
+
place-items: center;
|
|
40
|
+
text-rendering: optimizeLegibility;
|
|
41
|
+
-webkit-text-size-adjust: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#error-description {
|
|
45
|
+
fill: #d30001;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#error-id {
|
|
49
|
+
fill: #f0eff0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (prefers-color-scheme: dark) {
|
|
53
|
+
body {
|
|
54
|
+
background: #101010;
|
|
55
|
+
color: #e0e0e0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#error-description {
|
|
59
|
+
fill: #FF6161;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#error-id {
|
|
63
|
+
fill: #2c2c2c;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
a {
|
|
68
|
+
color: inherit;
|
|
69
|
+
font-weight: 700;
|
|
70
|
+
text-decoration: underline;
|
|
71
|
+
text-underline-offset: 0.0925em;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
b, strong {
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
i, em {
|
|
79
|
+
font-style: italic;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
main {
|
|
83
|
+
display: grid;
|
|
84
|
+
gap: 1em;
|
|
85
|
+
padding: 2em;
|
|
86
|
+
place-items: center;
|
|
87
|
+
text-align: center;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main header {
|
|
91
|
+
width: min(100%, 12em);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main header svg {
|
|
95
|
+
height: auto;
|
|
96
|
+
max-width: 100%;
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
main article {
|
|
101
|
+
width: min(100%, 30em);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
main article p {
|
|
105
|
+
font-size: 75%;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
main article br {
|
|
109
|
+
display: none;
|
|
110
|
+
|
|
111
|
+
@media(min-width: 48em) {
|
|
112
|
+
display: inline;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
</style>
|
|
117
|
+
|
|
118
|
+
</head>
|
|
119
|
+
|
|
120
|
+
<body>
|
|
121
|
+
|
|
122
|
+
<!-- This file lives in public/500.html -->
|
|
123
|
+
|
|
124
|
+
<main>
|
|
125
|
+
<header>
|
|
126
|
+
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m101.23 93.8427c-8.1103 0-15.4098 3.7849-19.7354 8.3813h-36.2269v-99.21891h103.8143v37.03791h-68.3984v24.8722c5.1366-2.7035 15.1396-5.9477 24.6014-5.9477 35.146 0 56.233 22.7094 56.233 55.4215 0 34.605-23.791 57.315-60.558 57.315-37.8492 0-61.64-22.169-63.8028-55.963h42.9857c1.0814 10.814 9.1919 19.195 21.6281 19.195 11.355 0 19.465-8.381 19.465-20.547 0-11.625-7.299-20.5463-20.006-20.5463zm138.833 77.8613c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" id="error-id"/><path d="m23.1377 68.9967v34.0033h-8.9162v-34.0033zm4.3157 34.0033v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm29.9913-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.5839v6.8671h5.2058v6.7564h-5.2058v8.307c0 1.9383.9415 2.769 2.6583 2.769.9414 0 1.9937-.2216 2.769-.5538v7.3654c-.9969.443-2.8798.775-4.8181.775-5.8703 0-9.1931-2.769-9.1931-9.0819zm32.3666-.1108h8.0301c-.8861 5.7597-5.2057 9.2487-11.6852 9.2487-7.6424 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.3165-13.0143 12.5159-13.0143 7.6424 0 11.9621 5.095 11.9621 12.5159v2.1598h-16.1156c.2769 2.9905 1.8275 4.5965 4.3196 4.5965 1.7722 0 3.1567-.7753 3.6551-2.4921zm-3.8212-10.0237c-2.0491 0-3.4336 1.2737-3.9874 3.5997h7.5317c-.1107-2.0491-1.3845-3.5997-3.5443-3.5997zm31.4299-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.599-.7753-2.382 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.381.443zm2.949 25.0318v-24.921h8.694v2.1598c1.385-1.5506 3.821-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.64v-14.2327c0-2.049-1.052-3.5443-3.267-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm50.371 0h-8.363v-1.274c-.83.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.433.7199-3.433 2.3813 0 1.7168 1.716 2.4367 3.433 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742-29.0191v35.997h-8.694v-35.997zm13.036 25.9178h9.248c.72 2.326 2.714 3.489 5.483 3.489 2.713 0 4.596-1.163 4.596-3.2674 0-1.6061-1.052-2.326-3.212-2.8244l-6.534-1.3845c-4.985-1.1076-8.751-3.7105-8.751-9.47 0-6.6456 5.538-11.0206 13.07-11.0206 8.307 0 13.014 4.5411 13.956 10.4114h-8.695c-.72-1.8829-2.27-3.3228-5.205-3.3228-2.548 0-4.265 1.1076-4.265 2.9905 0 1.4953 1.052 2.326 2.825 2.7137l6.645 1.5506c5.815 1.3845 9.027 4.5412 9.027 9.8023 0 6.9778-5.87 10.9654-13.291 10.9654-8.141 0-13.679-3.9322-14.897-10.6332zm46.509 1.3845h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm31.431-6.3134v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.382.443zm18.288 25.0318h-7.809l-9.47-24.921h8.861l4.763 14.288 4.652-14.288h8.528zm25.614-8.6947h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997zm31.43-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443zm13.703-8.9715h24.312v7.6424h-15.562v5.3165h14.232v7.4763h-14.232v5.8703h15.562v7.6978h-24.312zm44.667 8.9715v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm19.673 0v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm28.082-12.5713v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443z" id="error-description"/></svg>
|
|
127
|
+
</header>
|
|
128
|
+
<article>
|
|
129
|
+
<p><strong>We're sorry, but something went wrong.</strong><br> If you're the application owner check the logs for more information.</p>
|
|
130
|
+
</article>
|
|
131
|
+
</main>
|
|
132
|
+
|
|
133
|
+
</body>
|
|
134
|
+
|
|
135
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
data/demo/script/.keep
ADDED
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
4
|
+
require_relative '../config/environment'
|
|
5
|
+
# Prevent database truncation if the environment is production
|
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
|
7
|
+
# Uncomment the line below in case you have `--require rails_helper` in the `.rspec` file
|
|
8
|
+
# that will avoid rails generators crashing because migrations haven't been run yet
|
|
9
|
+
# return unless Rails.env.test?
|
|
10
|
+
require 'rspec/rails'
|
|
11
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
|
12
|
+
|
|
13
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
14
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
15
|
+
# run as spec files by default. This means that files in spec/support that end
|
|
16
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
17
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
|
18
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
19
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
20
|
+
#
|
|
21
|
+
# The following line is provided for convenience purposes. It has the downside
|
|
22
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
|
23
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
|
24
|
+
# require only the support files necessary.
|
|
25
|
+
#
|
|
26
|
+
# Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
|
|
27
|
+
|
|
28
|
+
# Ensures that the test database schema matches the current schema file.
|
|
29
|
+
# If there are pending migrations it will invoke `db:test:prepare` to
|
|
30
|
+
# recreate the test database by loading the schema.
|
|
31
|
+
# If you are not using ActiveRecord, you can remove these lines.
|
|
32
|
+
begin
|
|
33
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
34
|
+
rescue ActiveRecord::PendingMigrationError => e
|
|
35
|
+
abort e.to_s.strip
|
|
36
|
+
end
|
|
37
|
+
RSpec.configure do |config|
|
|
38
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
39
|
+
config.fixture_paths = [
|
|
40
|
+
Rails.root.join('spec/fixtures')
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
44
|
+
# examples within a transaction, remove the following line or assign false
|
|
45
|
+
# instead of true.
|
|
46
|
+
config.use_transactional_fixtures = true
|
|
47
|
+
|
|
48
|
+
# You can uncomment this line to turn off ActiveRecord support entirely.
|
|
49
|
+
# config.use_active_record = false
|
|
50
|
+
|
|
51
|
+
# RSpec Rails uses metadata to mix in different behaviours to your tests,
|
|
52
|
+
# for example enabling you to call `get` and `post` in request specs. e.g.:
|
|
53
|
+
#
|
|
54
|
+
# RSpec.describe UsersController, type: :request do
|
|
55
|
+
# # ...
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# The different available types are documented in the features, such as in
|
|
59
|
+
# https://rspec.info/features/8-0/rspec-rails
|
|
60
|
+
#
|
|
61
|
+
# You can also this infer these behaviours automatically by location, e.g.
|
|
62
|
+
# /spec/models would pull in the same behaviour as `type: :model` but this
|
|
63
|
+
# behaviour is considered legacy and will be removed in a future version.
|
|
64
|
+
#
|
|
65
|
+
# To enable this behaviour uncomment the line below.
|
|
66
|
+
# config.infer_spec_type_from_file_location!
|
|
67
|
+
|
|
68
|
+
# Filter lines from Rails gems in backtraces.
|
|
69
|
+
config.filter_rails_from_backtrace!
|
|
70
|
+
# arbitrary gems may also be filtered via:
|
|
71
|
+
# config.filter_gems_from_backtrace("gem name")
|
|
72
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
|
5
|
+
# files.
|
|
6
|
+
#
|
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
|
13
|
+
# it.
|
|
14
|
+
#
|
|
15
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
16
|
+
RSpec.configure do |config|
|
|
17
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
18
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
19
|
+
# assertions if you prefer.
|
|
20
|
+
config.expect_with :rspec do |expectations|
|
|
21
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
|
22
|
+
# and `failure_message` of custom matchers include text for helper methods
|
|
23
|
+
# defined using `chain`, e.g.:
|
|
24
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
|
25
|
+
# # => "be bigger than 2 and smaller than 4"
|
|
26
|
+
# ...rather than:
|
|
27
|
+
# # => "be bigger than 2"
|
|
28
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
32
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
33
|
+
config.mock_with :rspec do |mocks|
|
|
34
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
35
|
+
# a real object. This is generally recommended, and will default to
|
|
36
|
+
# `true` in RSpec 4.
|
|
37
|
+
mocks.verify_partial_doubles = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
|
41
|
+
# have no way to turn it off -- the option exists only for backwards
|
|
42
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
|
43
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
|
44
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
|
45
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
46
|
+
|
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
49
|
+
=begin
|
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
|
55
|
+
config.filter_run_when_matching :focus
|
|
56
|
+
|
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
59
|
+
# you configure your source control system to ignore this file.
|
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
61
|
+
|
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
|
63
|
+
# recommended. For more details, see:
|
|
64
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
|
65
|
+
config.disable_monkey_patching!
|
|
66
|
+
|
|
67
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
68
|
+
# file, and it's useful to allow more verbose output when running an
|
|
69
|
+
# individual spec file.
|
|
70
|
+
if config.files_to_run.one?
|
|
71
|
+
# Use the documentation formatter for detailed output,
|
|
72
|
+
# unless a formatter has already been configured
|
|
73
|
+
# (e.g. via a command-line flag).
|
|
74
|
+
config.default_formatter = "doc"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Print the 10 slowest examples and example groups at the
|
|
78
|
+
# end of the spec run, to help surface which specs are running
|
|
79
|
+
# particularly slow.
|
|
80
|
+
config.profile_examples = 10
|
|
81
|
+
|
|
82
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
83
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
84
|
+
# the seed, which is printed after each run.
|
|
85
|
+
# --seed 1234
|
|
86
|
+
config.order = :random
|
|
87
|
+
|
|
88
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
89
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
90
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
91
|
+
# as the one that triggered the failure.
|
|
92
|
+
Kernel.srand config.seed
|
|
93
|
+
=end
|
|
94
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "rails_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Admin Articles", type: :system do
|
|
4
|
+
before do
|
|
5
|
+
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "saves markdown body when creating an article" do
|
|
9
|
+
visit "/admin/articles/new"
|
|
10
|
+
|
|
11
|
+
fill_in "Title", with: "Test Article"
|
|
12
|
+
|
|
13
|
+
editor_textarea = find(".mitosis-textarea", visible: :all)
|
|
14
|
+
editor_textarea.set("# Hello World")
|
|
15
|
+
|
|
16
|
+
click_button "Create Article"
|
|
17
|
+
|
|
18
|
+
article = Article.last
|
|
19
|
+
expect(article.title).to eq("Test Article")
|
|
20
|
+
expect(article.body).to eq("# Hello World")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "rails_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Mitosis Editor Prism Syntax Highlighting", type: :system do
|
|
4
|
+
before do
|
|
5
|
+
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "loads Prism CSS and JS when enabled" do
|
|
9
|
+
visit "/admin/articles/new"
|
|
10
|
+
|
|
11
|
+
html = page.html
|
|
12
|
+
|
|
13
|
+
# Check Prism CSS is loaded
|
|
14
|
+
expect(html).to include("prismjs@1.29.0/themes/prism-tomorrow.min.css")
|
|
15
|
+
|
|
16
|
+
# Check Prism JS scripts are loaded
|
|
17
|
+
expect(html).to include("prismjs@1.29.0/prism.min.js")
|
|
18
|
+
expect(html).to include("prism-javascript.min.js")
|
|
19
|
+
expect(html).to include("prism-typescript.min.js")
|
|
20
|
+
expect(html).to include("prism-python.min.js")
|
|
21
|
+
expect(html).to include("prism-css.min.js")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "makes Prism available globally" do
|
|
25
|
+
visit "/admin/articles/new"
|
|
26
|
+
|
|
27
|
+
# Wait for page to fully load
|
|
28
|
+
expect(page).to have_css(".mitosis-editor-wrapper")
|
|
29
|
+
|
|
30
|
+
# Verify Prism is available on window
|
|
31
|
+
prism_available = page.evaluate_script("typeof window.Prism !== 'undefined'")
|
|
32
|
+
expect(prism_available).to be true
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require "rails_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Mitosis Editor Theme", type: :system do
|
|
4
|
+
before do
|
|
5
|
+
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
after do
|
|
9
|
+
execute_script("localStorage.clear(); document.documentElement.classList.remove('dark')")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def editor_wrapper
|
|
13
|
+
find(".mitosis-editor-wrapper[data-theme]", visible: :all)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def toggle_aa_dark_mode
|
|
17
|
+
execute_script("localStorage.setItem('theme', 'dark'); document.documentElement.classList.add('dark')")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def toggle_aa_light_mode
|
|
21
|
+
execute_script("localStorage.setItem('theme', 'light'); document.documentElement.classList.remove('dark')")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
context "with theme: 'dark' (Article)" do
|
|
25
|
+
it "always uses dark theme regardless of AA theme" do
|
|
26
|
+
visit "/admin/articles/new"
|
|
27
|
+
|
|
28
|
+
expect(editor_wrapper["data-theme"]).to eq("dark")
|
|
29
|
+
|
|
30
|
+
toggle_aa_dark_mode
|
|
31
|
+
expect(editor_wrapper["data-theme"]).to eq("dark")
|
|
32
|
+
|
|
33
|
+
toggle_aa_light_mode
|
|
34
|
+
expect(editor_wrapper["data-theme"]).to eq("dark")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context "with theme: 'light' (Post)" do
|
|
39
|
+
it "always uses light theme regardless of AA theme" do
|
|
40
|
+
visit "/admin/posts/new"
|
|
41
|
+
|
|
42
|
+
expect(editor_wrapper["data-theme"]).to eq("light")
|
|
43
|
+
|
|
44
|
+
toggle_aa_dark_mode
|
|
45
|
+
expect(editor_wrapper["data-theme"]).to eq("light")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context "with theme: 'auto' (Page)" do
|
|
50
|
+
it "follows AA theme changes" do
|
|
51
|
+
visit "/admin/pages/new"
|
|
52
|
+
|
|
53
|
+
toggle_aa_light_mode
|
|
54
|
+
expect(editor_wrapper["data-theme"]).to eq("light")
|
|
55
|
+
|
|
56
|
+
toggle_aa_dark_mode
|
|
57
|
+
expect(editor_wrapper["data-theme"]).to eq("dark")
|
|
58
|
+
|
|
59
|
+
toggle_aa_light_mode
|
|
60
|
+
expect(editor_wrapper["data-theme"]).to eq("light")
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
data/demo/storage/.keep
ADDED
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
const activeAdminPath = execSync('bundle show activeadmin', { encoding: 'utf-8' }).trim().split(/\r?\n/).pop();
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
content: [
|
|
7
|
+
`${activeAdminPath}/vendor/javascript/flowbite.js`,
|
|
8
|
+
`${activeAdminPath}/plugin.js`,
|
|
9
|
+
`${activeAdminPath}/app/views/**/*.{arb,erb,html,rb}`,
|
|
10
|
+
'./app/admin/**/*.{arb,erb,html,rb}',
|
|
11
|
+
'./app/views/active_admin/**/*.{arb,erb,html,rb}',
|
|
12
|
+
'./app/views/admin/**/*.{arb,erb,html,rb}',
|
|
13
|
+
'./app/views/layouts/active_admin*.{erb,html}',
|
|
14
|
+
'./app/javascript/**/*.js'
|
|
15
|
+
],
|
|
16
|
+
darkMode: "selector",
|
|
17
|
+
}
|
data/demo/tmp/.keep
ADDED
|
File without changes
|
|
File without changes
|
data/demo/vendor/.keep
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# activeadmin-mitosis-editor Design
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-02-15
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
A Ruby gem that wraps the `mitosis-js` npm package as a custom input type for ActiveAdmin, providing a split-view markdown editor with live preview.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
### Components
|
|
12
|
+
|
|
13
|
+
1. **Input Class** - Formtastic-compatible input for ActiveAdmin DSL
|
|
14
|
+
2. **View Template** - ERB template that renders editor container + JS initialization
|
|
15
|
+
3. **Bundled Assets** - mitosis-js + Prism.js included in gem
|
|
16
|
+
4. **Railtie** - Registers assets with Rails asset pipeline
|
|
17
|
+
|
|
18
|
+
### Data Flow
|
|
19
|
+
|
|
20
|
+
1. **Form Load**: JS initializes editor with initial value (from model or empty)
|
|
21
|
+
2. **User Types**: Editor updates preview in real-time
|
|
22
|
+
3. **Form Submit**: JS copies markdown value to hidden input field for form submission
|
|
23
|
+
|
|
24
|
+
## DSL Usage
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
# Basic usage
|
|
28
|
+
f.input :body, as: :mitosis_editor
|
|
29
|
+
|
|
30
|
+
# With options
|
|
31
|
+
f.input :body, as: :mitosis_editor, height: '400px', placeholder: 'Write markdown...'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Supported Options
|
|
35
|
+
|
|
36
|
+
| Option | Type | Default | Description |
|
|
37
|
+
|--------|------|---------|-------------|
|
|
38
|
+
| `height` | string | `'500px'` | Editor container height |
|
|
39
|
+
| `placeholder` | string | `''` | Placeholder text |
|
|
40
|
+
| `prism_languages` | array | `['javascript', 'typescript', 'python', 'css']` | Syntax highlighting languages |
|
|
41
|
+
|
|
42
|
+
## File Structure
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
lib/
|
|
46
|
+
├── activeadmin_mitosis_editor.rb # Main gem entry point
|
|
47
|
+
├── activeadmin_mitosis_editor/
|
|
48
|
+
│ ├── version.rb
|
|
49
|
+
│ └── railtie.rb # Rails integration
|
|
50
|
+
app/
|
|
51
|
+
├── inputs/
|
|
52
|
+
│ └── mitosis_editor_input.rb # Formtastic input
|
|
53
|
+
├── views/
|
|
54
|
+
│ └── inputs/
|
|
55
|
+
│ └── mitosis_editor_input/
|
|
56
|
+
│ └── _form.html.erb # Editor template
|
|
57
|
+
vendor/
|
|
58
|
+
└── assets/
|
|
59
|
+
├── javascripts/
|
|
60
|
+
│ ├── mitosis-editor.js # Bundled mitosis-js
|
|
61
|
+
│ └── prism/ # Bundled Prism.js
|
|
62
|
+
└── stylesheets/
|
|
63
|
+
└── mitosis-editor.css # Bundled editor styles
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Implementation Notes
|
|
67
|
+
|
|
68
|
+
- Assets bundled from mitosis-js npm package (built dist)
|
|
69
|
+
- Self-hosted approach: assets served via gem's asset pipeline
|
|
70
|
+
- Works with Sprockets (Rails 6.x) and importmap (Rails 7.x)
|