pressroom 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 +22 -0
- data/MIT-LICENSE +20 -0
- data/README.md +172 -0
- data/Rakefile +8 -0
- data/app/assets/javascripts/pressroom/application.js +18 -0
- data/app/assets/javascripts/pressroom/controllers/editor_controller.js +146 -0
- data/app/assets/javascripts/pressroom/vendor/code.js +181 -0
- data/app/assets/javascripts/pressroom/vendor/delimiter.js +98 -0
- data/app/assets/javascripts/pressroom/vendor/editorjs.js +11217 -0
- data/app/assets/javascripts/pressroom/vendor/header.js +321 -0
- data/app/assets/javascripts/pressroom/vendor/image.js +1103 -0
- data/app/assets/javascripts/pressroom/vendor/inline-code.js +99 -0
- data/app/assets/javascripts/pressroom/vendor/list.js +2091 -0
- data/app/assets/javascripts/pressroom/vendor/marker.js +95 -0
- data/app/assets/javascripts/pressroom/vendor/quote.js +990 -0
- data/app/assets/javascripts/pressroom/vendor/stimulus.js +2563 -0
- data/app/assets/javascripts/pressroom/vendor/turbo.js +7256 -0
- data/app/assets/stylesheets/pressroom/admin.css +216 -0
- data/app/assets/stylesheets/pressroom/content.css +18 -0
- data/app/controllers/pressroom/application_controller.rb +41 -0
- data/app/controllers/pressroom/categories_controller.rb +50 -0
- data/app/controllers/pressroom/posts_controller.rb +98 -0
- data/app/controllers/pressroom/tags_controller.rb +39 -0
- data/app/controllers/pressroom/uploads_controller.rb +52 -0
- data/app/helpers/pressroom/application_helper.rb +4 -0
- data/app/helpers/pressroom/blocks_helper.rb +13 -0
- data/app/jobs/pressroom/application_job.rb +4 -0
- data/app/mailers/pressroom/application_mailer.rb +6 -0
- data/app/models/concerns/pressroom/authorable.rb +23 -0
- data/app/models/concerns/pressroom/sluggable.rb +66 -0
- data/app/models/pressroom/application_record.rb +7 -0
- data/app/models/pressroom/category.rb +54 -0
- data/app/models/pressroom/post.rb +90 -0
- data/app/models/pressroom/tag.rb +30 -0
- data/app/models/pressroom/tagging.rb +12 -0
- data/app/views/layouts/pressroom/admin.html.erb +34 -0
- data/app/views/layouts/pressroom/application.html.erb +17 -0
- data/app/views/pressroom/blocks/_code.html.erb +2 -0
- data/app/views/pressroom/blocks/_delimiter.html.erb +1 -0
- data/app/views/pressroom/blocks/_header.html.erb +5 -0
- data/app/views/pressroom/blocks/_image.html.erb +18 -0
- data/app/views/pressroom/blocks/_list.html.erb +6 -0
- data/app/views/pressroom/blocks/_list_items.html.erb +13 -0
- data/app/views/pressroom/blocks/_paragraph.html.erb +1 -0
- data/app/views/pressroom/blocks/_quote.html.erb +6 -0
- data/app/views/pressroom/categories/_form.html.erb +31 -0
- data/app/views/pressroom/categories/edit.html.erb +3 -0
- data/app/views/pressroom/categories/index.html.erb +34 -0
- data/app/views/pressroom/categories/new.html.erb +3 -0
- data/app/views/pressroom/posts/_form.html.erb +49 -0
- data/app/views/pressroom/posts/_post_row.html.erb +17 -0
- data/app/views/pressroom/posts/edit.html.erb +34 -0
- data/app/views/pressroom/posts/index.html.erb +38 -0
- data/app/views/pressroom/posts/new.html.erb +3 -0
- data/app/views/pressroom/tags/edit.html.erb +24 -0
- data/app/views/pressroom/tags/index.html.erb +27 -0
- data/config/editorjs_manifest.yml +53 -0
- data/config/importmap.rb +18 -0
- data/config/locales/pressroom.en.yml +16 -0
- data/config/locales/transliteration.ru.yml +70 -0
- data/config/locales/transliteration.uk.yml +70 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20260821000001_create_pressroom_posts.rb +42 -0
- data/db/migrate/20260821000002_create_pressroom_taxonomy.rb +33 -0
- data/lib/pressroom/blocks/definition.rb +103 -0
- data/lib/pressroom/blocks/registry.rb +56 -0
- data/lib/pressroom/blocks/renderer.rb +97 -0
- data/lib/pressroom/blocks/sanitizer.rb +36 -0
- data/lib/pressroom/blocks/schema.rb +247 -0
- data/lib/pressroom/blocks/text_extractor.rb +46 -0
- data/lib/pressroom/built_in_blocks.rb +97 -0
- data/lib/pressroom/configuration.rb +64 -0
- data/lib/pressroom/engine.rb +33 -0
- data/lib/pressroom/errors.rb +11 -0
- data/lib/pressroom/feed.rb +69 -0
- data/lib/pressroom/transliteration.rb +213 -0
- data/lib/pressroom/version.rb +3 -0
- data/lib/pressroom.rb +70 -0
- data/lib/tasks/pressroom_tasks.rake +4 -0
- data/lib/tasks/pressroom_vendor.rake +31 -0
- metadata +171 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".cdx-marker{background:rgba(245,235,111,.29);padding:3px 0}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
+
const o = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M11.3536 9.31802L12.7678 7.90381C13.5488 7.12276 14.8151 7.12276 15.5962 7.90381C16.3772 8.68486 16.3772 9.95119 15.5962 10.7322L14.182 12.1464M11.3536 9.31802L7.96729 12.7043C7.40889 13.2627 7.02827 13.9739 6.8734 14.7482L6.69798 15.6253C6.55804 16.325 7.17496 16.942 7.87468 16.802L8.75176 16.6266C9.52612 16.4717 10.2373 16.0911 10.7957 15.5327L14.182 12.1464M11.3536 9.31802L14.182 12.1464"/><line x1="15" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>';
|
|
3
|
+
class s {
|
|
4
|
+
/**
|
|
5
|
+
* Class name for term-tag
|
|
6
|
+
*
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
static get CSS() {
|
|
10
|
+
return "cdx-marker";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param {{api: object}} - Editor.js API
|
|
14
|
+
*/
|
|
15
|
+
constructor({ api: t }) {
|
|
16
|
+
this.api = t, this.button = null, this.tag = "MARK", this.iconClasses = {
|
|
17
|
+
base: this.api.styles.inlineToolButton,
|
|
18
|
+
active: this.api.styles.inlineToolButtonActive
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Specifies Tool as Inline Toolbar Tool
|
|
23
|
+
*
|
|
24
|
+
* @return {boolean}
|
|
25
|
+
*/
|
|
26
|
+
static get isInline() {
|
|
27
|
+
return !0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create button element for Toolbar
|
|
31
|
+
*
|
|
32
|
+
* @return {HTMLElement}
|
|
33
|
+
*/
|
|
34
|
+
render() {
|
|
35
|
+
return this.button = document.createElement("button"), this.button.type = "button", this.button.classList.add(this.iconClasses.base), this.button.innerHTML = this.toolboxIcon, this.button;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Wrap/Unwrap selected fragment
|
|
39
|
+
*
|
|
40
|
+
* @param {Range} range - selected fragment
|
|
41
|
+
*/
|
|
42
|
+
surround(t) {
|
|
43
|
+
if (!t)
|
|
44
|
+
return;
|
|
45
|
+
let e = this.api.selection.findParentTag(this.tag, s.CSS);
|
|
46
|
+
e ? this.unwrap(e) : this.wrap(t);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Wrap selection with term-tag
|
|
50
|
+
*
|
|
51
|
+
* @param {Range} range - selected fragment
|
|
52
|
+
*/
|
|
53
|
+
wrap(t) {
|
|
54
|
+
let e = document.createElement(this.tag);
|
|
55
|
+
e.classList.add(s.CSS), e.appendChild(t.extractContents()), t.insertNode(e), this.api.selection.expandToTag(e);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Unwrap term-tag
|
|
59
|
+
*
|
|
60
|
+
* @param {HTMLElement} termWrapper - term wrapper tag
|
|
61
|
+
*/
|
|
62
|
+
unwrap(t) {
|
|
63
|
+
this.api.selection.expandToTag(t);
|
|
64
|
+
let e = window.getSelection(), n = e.getRangeAt(0), i = n.extractContents();
|
|
65
|
+
t.parentNode.removeChild(t), n.insertNode(i), e.removeAllRanges(), e.addRange(n);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check and change Term's state for current selection
|
|
69
|
+
*/
|
|
70
|
+
checkState() {
|
|
71
|
+
const t = this.api.selection.findParentTag(this.tag, s.CSS);
|
|
72
|
+
this.button.classList.toggle(this.iconClasses.active, !!t);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get Tool icon's SVG
|
|
76
|
+
* @return {string}
|
|
77
|
+
*/
|
|
78
|
+
get toolboxIcon() {
|
|
79
|
+
return o;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sanitizer rule
|
|
83
|
+
* @return {{mark: {class: string}}}
|
|
84
|
+
*/
|
|
85
|
+
static get sanitize() {
|
|
86
|
+
return {
|
|
87
|
+
mark: {
|
|
88
|
+
class: s.CSS
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
s as default
|
|
95
|
+
};
|