decidim-core 0.31.3 → 0.31.4
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/cells/decidim/nav_links/show.erb +3 -3
- data/app/cells/decidim/participatory_space_private_user/show.erb +6 -6
- data/app/cells/decidim/participatory_space_private_user_cell.rb +0 -4
- data/app/helpers/decidim/mailer_helper.rb +36 -0
- data/app/helpers/decidim/menu_helper.rb +2 -1
- data/app/helpers/decidim/newsletters_helper.rb +4 -22
- data/app/mailers/decidim/application_mailer.rb +4 -0
- data/app/packs/src/decidim/controllers/accordion/accordion.test.js +118 -0
- data/app/packs/src/decidim/controllers/accordion/controller.js +24 -0
- data/app/packs/src/decidim/controllers/dropdown/controller.js +26 -0
- data/app/packs/src/decidim/controllers/dropdown/dropdown.test.js +187 -0
- data/app/packs/src/decidim/controllers/form_validator/form_validator.js +3 -2
- data/app/packs/src/decidim/controllers/form_validator/form_validator.test.js +5 -0
- data/app/packs/src/decidim/editor/extensions/image/index.js +49 -11
- data/app/packs/src/decidim/editor/extensions/image/node_view.js +9 -1
- data/app/packs/src/decidim/editor/extensions/link/bubble_menu.js +34 -6
- data/app/packs/src/decidim/editor/extensions/link/index.js +45 -12
- data/app/packs/src/decidim/editor/test/extensions/image_links.test.js +161 -0
- data/app/packs/stylesheets/decidim/_rich_text.scss +17 -0
- data/app/packs/stylesheets/decidim/editor.scss +10 -0
- data/app/presenters/decidim/menu_item_presenter.rb +7 -1
- data/app/views/decidim/devise/registrations/new.html.erb +1 -0
- data/app/views/decidim/devise/shared/_tos_fields.html.erb +3 -3
- data/app/views/decidim/notification_mailer/event_received.html.erb +3 -3
- data/app/views/decidim/pages/_tabbed.html.erb +3 -3
- data/app/views/decidim/shared/_filters.html.erb +5 -5
- data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -1
- data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
- data/config/locales/de.yml +27 -0
- data/config/locales/eu.yml +3 -0
- data/config/locales/fi-plain.yml +5 -0
- data/config/locales/fi.yml +5 -0
- data/lib/decidim/content_parsers/blob_parser.rb +3 -3
- data/lib/decidim/content_renderers/blob_renderer.rb +2 -2
- data/lib/decidim/core/test/shared_examples/participatory_space_members_shared_examples.rb +121 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/participatory_space_user.rb +1 -1
- metadata +11 -6
|
@@ -80,7 +80,9 @@ export default Image.extend({
|
|
|
80
80
|
addAttributes() {
|
|
81
81
|
return {
|
|
82
82
|
...this.parent?.(),
|
|
83
|
-
width: { default: null }
|
|
83
|
+
width: { default: null },
|
|
84
|
+
href: { default: null },
|
|
85
|
+
target: { default: null }
|
|
84
86
|
};
|
|
85
87
|
},
|
|
86
88
|
|
|
@@ -92,13 +94,16 @@ export default Image.extend({
|
|
|
92
94
|
...this.parent?.(),
|
|
93
95
|
imageDialog: () => async ({ dispatch }) => {
|
|
94
96
|
if (dispatch) {
|
|
95
|
-
let { src, alt, width } = this.editor.getAttributes("image");
|
|
97
|
+
let { src, alt, width, href, target } = this.editor.getAttributes("image");
|
|
96
98
|
|
|
97
99
|
this.editor.commands.toggleDialog(true);
|
|
98
|
-
const dialogState = await uploadDialog.toggle(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const dialogState = await uploadDialog.toggle(
|
|
101
|
+
{ src, alt },
|
|
102
|
+
{
|
|
103
|
+
inputLabel: i18n.altLabel,
|
|
104
|
+
uploadHandler: async (file) => uploadImage(file, this.options.uploadImagesPath)
|
|
105
|
+
}
|
|
106
|
+
);
|
|
102
107
|
this.editor.commands.toggleDialog(false);
|
|
103
108
|
|
|
104
109
|
if (dialogState !== "save") {
|
|
@@ -113,8 +118,7 @@ export default Image.extend({
|
|
|
113
118
|
|
|
114
119
|
src = uploadDialog.getValue("src");
|
|
115
120
|
alt = uploadDialog.getValue("alt");
|
|
116
|
-
|
|
117
|
-
return this.editor.chain().setImage({ src, alt, width }).focus(null, { scrollIntoView: false }).run();
|
|
121
|
+
return this.editor.chain().setImage({ src, alt, width, href, target }).focus(null, { scrollIntoView: false }).run();
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
return true;
|
|
@@ -127,18 +131,52 @@ export default Image.extend({
|
|
|
127
131
|
},
|
|
128
132
|
|
|
129
133
|
parseHTML() {
|
|
130
|
-
return [
|
|
134
|
+
return [
|
|
135
|
+
{
|
|
136
|
+
tag: "div[data-image] img[src]:not([src^='data:'])",
|
|
137
|
+
getAttrs: (dom) => {
|
|
138
|
+
// Check if the image's parent div is wrapped in a link
|
|
139
|
+
const imageDiv = dom.closest("div[data-image]");
|
|
140
|
+
const link = imageDiv?.parentElement;
|
|
141
|
+
if (link && link.tagName === "A" && link.hasAttribute("href")) {
|
|
142
|
+
const attrs = { href: link.getAttribute("href") };
|
|
143
|
+
if (link.hasAttribute("target")) {
|
|
144
|
+
attrs.target = link.getAttribute("target");
|
|
145
|
+
}
|
|
146
|
+
return attrs;
|
|
147
|
+
}
|
|
148
|
+
return {};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
];
|
|
131
152
|
},
|
|
132
153
|
|
|
133
154
|
renderHTML({ HTMLAttributes }) {
|
|
134
|
-
|
|
155
|
+
const { href, target, ...imgAttributes } = HTMLAttributes;
|
|
156
|
+
const imageContent = [
|
|
135
157
|
"div",
|
|
136
158
|
{ "class": "editor-content-image", "data-image": "" },
|
|
137
159
|
[
|
|
138
160
|
"img",
|
|
139
|
-
mergeAttributes(this.options.HTMLAttributes,
|
|
161
|
+
mergeAttributes(this.options.HTMLAttributes, imgAttributes)
|
|
140
162
|
]
|
|
141
163
|
];
|
|
164
|
+
|
|
165
|
+
if (href) {
|
|
166
|
+
const anchorAttributes = { href };
|
|
167
|
+
const anchorTarget = target;
|
|
168
|
+
if (anchorTarget) {
|
|
169
|
+
anchorAttributes.target = anchorTarget;
|
|
170
|
+
anchorAttributes.rel = "noopener noreferrer";
|
|
171
|
+
}
|
|
172
|
+
return [
|
|
173
|
+
"a",
|
|
174
|
+
anchorAttributes,
|
|
175
|
+
imageContent
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return imageContent;
|
|
142
180
|
},
|
|
143
181
|
|
|
144
182
|
addProseMirrorPlugins() {
|
|
@@ -62,7 +62,9 @@ export default (self) => {
|
|
|
62
62
|
const img = contentDOM.querySelector("img");
|
|
63
63
|
let activeResizeControl = null,
|
|
64
64
|
currentHeight = null,
|
|
65
|
+
currentHref = node.attrs.href,
|
|
65
66
|
currentSrc = node.attrs.src,
|
|
67
|
+
currentTarget = node.attrs.target,
|
|
66
68
|
currentWidth = null,
|
|
67
69
|
naturalHeight = img.naturalHeight,
|
|
68
70
|
naturalWidth = img.naturalWidth,
|
|
@@ -185,7 +187,13 @@ export default (self) => {
|
|
|
185
187
|
return false;
|
|
186
188
|
}
|
|
187
189
|
|
|
188
|
-
const { alt, src, title, width } = updatedNode.attrs;
|
|
190
|
+
const { alt, src, title, width, href, target } = updatedNode.attrs;
|
|
191
|
+
|
|
192
|
+
// If the href or target changed, we need to recreate the node because the
|
|
193
|
+
// structure changes (wrapped in <a> vs not wrapped)
|
|
194
|
+
if (href !== currentHref || target !== currentTarget) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
189
197
|
|
|
190
198
|
// We set the value through an attribute change here because otherwise
|
|
191
199
|
// we would trigger a mutation in the DOM which causes the update method
|
|
@@ -1,25 +1,53 @@
|
|
|
1
|
-
import { PluginKey } from "prosemirror-state";
|
|
1
|
+
import { NodeSelection, PluginKey } from "prosemirror-state";
|
|
2
2
|
|
|
3
3
|
import { getDictionary } from "src/decidim/refactor/moved/i18n";
|
|
4
4
|
import BubbleMenu from "src/decidim/editor/common/bubble_menu";
|
|
5
5
|
|
|
6
6
|
class LinkBubbleMenu extends BubbleMenu {
|
|
7
|
-
shouldDisplay() {
|
|
8
|
-
|
|
7
|
+
shouldDisplay(view) {
|
|
8
|
+
if (this.editor.isActive("link")) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const selection = view.state.selection;
|
|
13
|
+
return this.isImage(selection) && Boolean(selection.node.attrs.href);
|
|
9
14
|
}
|
|
10
15
|
|
|
11
|
-
display() {
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
display(view) {
|
|
17
|
+
if (this.editor.isActive("link")) {
|
|
18
|
+
const { href } = this.editor.getAttributes("link");
|
|
19
|
+
this.updateHref(href);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const selection = view.state.selection;
|
|
24
|
+
if (this.isImage(selection)) {
|
|
25
|
+
this.bubble.style.zIndex = "10";
|
|
26
|
+
this.updateHref(selection.node.attrs.href);
|
|
27
|
+
}
|
|
14
28
|
}
|
|
15
29
|
|
|
16
30
|
handleAction(action) {
|
|
17
31
|
if (action === "remove") {
|
|
32
|
+
const { selection } = this.editor.state;
|
|
33
|
+
if (this.isImage(selection)) {
|
|
34
|
+
this.editor.chain().focus(null, { scrollIntoView: false }).updateAttributes("image", { href: null, target: null }).run();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
this.editor.chain().focus(null, { scrollIntoView: false }).unsetLink().run();
|
|
19
39
|
} else {
|
|
20
40
|
this.editor.commands.linkDialog();
|
|
21
41
|
}
|
|
22
42
|
}
|
|
43
|
+
|
|
44
|
+
updateHref(href) {
|
|
45
|
+
this.element.querySelector("[data-linkbubble-value]").textContent = href;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
isImage(selection) {
|
|
49
|
+
return selection instanceof NodeSelection && selection.node.type.name === "image";
|
|
50
|
+
}
|
|
23
51
|
}
|
|
24
52
|
|
|
25
53
|
const createElement = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Link from "@tiptap/extension-link";
|
|
2
|
-
import { Plugin } from "prosemirror-state";
|
|
2
|
+
import { Plugin, NodeSelection } from "prosemirror-state";
|
|
3
3
|
|
|
4
4
|
import { getDictionary } from "src/decidim/refactor/moved/i18n";
|
|
5
5
|
import InputDialog from "src/decidim/editor/common/input_dialog";
|
|
@@ -40,31 +40,55 @@ export default Link.extend({
|
|
|
40
40
|
...this.parent?.(),
|
|
41
41
|
|
|
42
42
|
toggleLinkBubble: () => ({ dispatch }) => {
|
|
43
|
+
const { selection } = this.editor.state;
|
|
44
|
+
const isImageSelection = selection instanceof NodeSelection && selection.node.type.name === "image";
|
|
45
|
+
const imageHasLink = isImageSelection && Boolean(selection.node.attrs.href);
|
|
46
|
+
|
|
43
47
|
if (dispatch) {
|
|
44
|
-
if (this.editor.isActive("link")) {
|
|
45
|
-
this.storage.bubbleMenu.
|
|
48
|
+
if (this.editor.isActive("link") || (isImageSelection && imageHasLink)) {
|
|
49
|
+
this.storage.bubbleMenu.handleSelectionChange(this.editor.view);
|
|
46
50
|
return true;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
this.storage.bubbleMenu.hide();
|
|
50
54
|
return false;
|
|
51
55
|
}
|
|
56
|
+
|
|
57
|
+
if (isImageSelection) {
|
|
58
|
+
return imageHasLink;
|
|
59
|
+
}
|
|
60
|
+
|
|
52
61
|
return this.editor.isActive("link");
|
|
53
62
|
},
|
|
54
63
|
|
|
55
64
|
linkDialog: () => async ({ dispatch, commands }) => {
|
|
56
65
|
if (dispatch) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
const { state } = this.editor;
|
|
67
|
+
const { selection } = state;
|
|
68
|
+
const isImageSelection = selection instanceof NodeSelection && selection.node.type.name === "image";
|
|
69
|
+
const nodeType = (() => {
|
|
70
|
+
if (isImageSelection) {
|
|
71
|
+
return "image";
|
|
72
|
+
}
|
|
73
|
+
return "link";
|
|
74
|
+
})();
|
|
75
|
+
|
|
76
|
+
if (!isImageSelection) {
|
|
77
|
+
// If the cursor is within the link but the link is not selected, the
|
|
78
|
+
// link would not be correctly updated. Also if only a part of the
|
|
79
|
+
// link is selected, the link would be split to separate links, only
|
|
80
|
+
// the current selection getting the updated link URL.
|
|
81
|
+
commands.extendMarkRange("link");
|
|
82
|
+
}
|
|
62
83
|
|
|
63
84
|
this.storage.bubbleMenu.hide();
|
|
64
85
|
|
|
65
86
|
const { allowTargetControl } = this.options;
|
|
66
87
|
|
|
67
|
-
let
|
|
88
|
+
let href = null;
|
|
89
|
+
let target = null;
|
|
90
|
+
|
|
91
|
+
({ href, target } = this.editor.getAttributes(nodeType));
|
|
68
92
|
|
|
69
93
|
const inputs = { href: { type: "text", label: i18n.hrefLabel } };
|
|
70
94
|
if (allowTargetControl) {
|
|
@@ -88,16 +112,25 @@ export default Link.extend({
|
|
|
88
112
|
target = null;
|
|
89
113
|
}
|
|
90
114
|
|
|
115
|
+
const buildChain = () => this.editor.chain().focus(null, { scrollIntoView: false });
|
|
116
|
+
|
|
91
117
|
if (dialogState !== "save") {
|
|
92
|
-
|
|
118
|
+
buildChain().toggleLinkBubble().run();
|
|
93
119
|
return false;
|
|
94
120
|
}
|
|
95
121
|
|
|
96
122
|
if (!href || href.trim().length < 1) {
|
|
97
|
-
|
|
123
|
+
if (isImageSelection) {
|
|
124
|
+
return buildChain().updateAttributes("image", { href: null, target: null }).run();
|
|
125
|
+
}
|
|
126
|
+
return buildChain().unsetLink().run();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (isImageSelection) {
|
|
130
|
+
return buildChain().updateAttributes("image", { href: href, target }).toggleLinkBubble().run();
|
|
98
131
|
}
|
|
99
132
|
|
|
100
|
-
return
|
|
133
|
+
return buildChain().setLink({ href: href, target }).toggleLinkBubble().run();
|
|
101
134
|
}
|
|
102
135
|
|
|
103
136
|
return true;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* global jest, global */
|
|
2
|
+
|
|
3
|
+
import { createBasicEditor, updateContent, sleep } from "src/decidim/editor/test/helpers";
|
|
4
|
+
|
|
5
|
+
import Dialog from "src/decidim/editor/extensions/dialog";
|
|
6
|
+
import Image from "src/decidim/editor/extensions/image";
|
|
7
|
+
import uploadTemplates from "src/decidim/editor/test/fixtures/upload_templates";
|
|
8
|
+
|
|
9
|
+
class DummyDialog {
|
|
10
|
+
constructor(element) { this.element = element; }
|
|
11
|
+
|
|
12
|
+
open() { this.element.dataset.dialogOpen = true; }
|
|
13
|
+
|
|
14
|
+
close() { this.element.dataset.dialogOpen = null; }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Not implemented in Jest
|
|
18
|
+
global.Touch = class Touch {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.pageX = options.pageX;
|
|
21
|
+
this.pageY = options.pageY;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe("Image (links)", () => {
|
|
26
|
+
let editor = null;
|
|
27
|
+
let editorElement = null;
|
|
28
|
+
let uploadDialogElement = null;
|
|
29
|
+
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
document.body.innerHTML = "";
|
|
32
|
+
|
|
33
|
+
const dialogWrapper = document.createElement("div");
|
|
34
|
+
dialogWrapper.innerHTML = uploadTemplates.redesign;
|
|
35
|
+
uploadDialogElement = dialogWrapper.firstElementChild;
|
|
36
|
+
uploadDialogElement.dataset.dialog = "testDialog";
|
|
37
|
+
uploadDialogElement.dialog = new DummyDialog(uploadDialogElement);
|
|
38
|
+
window.Decidim.currentDialogs = { testDialog: uploadDialogElement.dialog };
|
|
39
|
+
document.body.append(uploadDialogElement);
|
|
40
|
+
|
|
41
|
+
editor = createBasicEditor({
|
|
42
|
+
extensions: [Dialog, Image.configure({ uploadDialogSelector: "#upload_dialog", uploadImagesPath: "/editor_images", contentTypes: ["image/png"] })]
|
|
43
|
+
});
|
|
44
|
+
editorElement = editor.view.dom;
|
|
45
|
+
|
|
46
|
+
const csrf = document.createElement("meta");
|
|
47
|
+
csrf.setAttribute("name", "csrf-token");
|
|
48
|
+
csrf.setAttribute("content", "abcdef0123456789");
|
|
49
|
+
document.head.append(csrf);
|
|
50
|
+
|
|
51
|
+
global.fetch = jest.fn(() => Promise.resolve({ ok: true, json: () => Promise.resolve({ url: "/path/to/image.jpg" }) }));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
jest.restoreAllMocks();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("allows setting an image with href and target attributes", async () => {
|
|
59
|
+
editorElement.focus();
|
|
60
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image", href: "https://example.com", target: "_blank" });
|
|
61
|
+
await sleep(0);
|
|
62
|
+
|
|
63
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
64
|
+
<a href="https://example.com" target="_blank" rel="noopener noreferrer">
|
|
65
|
+
<div class="editor-content-image" data-image="">
|
|
66
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
67
|
+
</div>
|
|
68
|
+
</a>
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("allows setting an image with href but no target", async () => {
|
|
73
|
+
editorElement.focus();
|
|
74
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image", href: "https://example.com" });
|
|
75
|
+
await sleep(0);
|
|
76
|
+
|
|
77
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
78
|
+
<a href="https://example.com">
|
|
79
|
+
<div class="editor-content-image" data-image="">
|
|
80
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
81
|
+
</div>
|
|
82
|
+
</a>
|
|
83
|
+
`);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("parses existing HTML with linked images", async () => {
|
|
87
|
+
editorElement.focus();
|
|
88
|
+
await updateContent(editorElement,
|
|
89
|
+
'<a href="https://example.com" target="_blank"><div class="editor-content-image" data-image=""><img src="/path/to/image.jpg" alt="Test image"></div></a>',
|
|
90
|
+
editor
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
94
|
+
<a href="https://example.com" target="_blank" rel="noopener noreferrer">
|
|
95
|
+
<div class="editor-content-image" data-image="">
|
|
96
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
97
|
+
</div>
|
|
98
|
+
</a>
|
|
99
|
+
`);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("parses existing HTML with linked images without target", async () => {
|
|
103
|
+
editorElement.focus();
|
|
104
|
+
await updateContent(editorElement,
|
|
105
|
+
'<a href="https://example.com"><div class="editor-content-image" data-image=""><img src="/path/to/image.jpg" alt="Test image"></div></a>',
|
|
106
|
+
editor
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
110
|
+
<a href="https://example.com">
|
|
111
|
+
<div class="editor-content-image" data-image="">
|
|
112
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
113
|
+
</div>
|
|
114
|
+
</a>
|
|
115
|
+
`);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("allows updating image link attributes", async () => {
|
|
119
|
+
editorElement.focus();
|
|
120
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image", href: "https://example.com", target: "_blank" });
|
|
121
|
+
await sleep(0);
|
|
122
|
+
|
|
123
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image", href: "https://docs.example.com" });
|
|
124
|
+
await sleep(0);
|
|
125
|
+
|
|
126
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
127
|
+
<a href="https://docs.example.com">
|
|
128
|
+
<div class="editor-content-image" data-image="">
|
|
129
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
130
|
+
</div>
|
|
131
|
+
</a>
|
|
132
|
+
`);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("allows removing link from image", async () => {
|
|
136
|
+
editorElement.focus();
|
|
137
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image", href: "https://example.com", target: "_blank" });
|
|
138
|
+
await sleep(0);
|
|
139
|
+
|
|
140
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image", href: null, target: null });
|
|
141
|
+
await sleep(0);
|
|
142
|
+
|
|
143
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
144
|
+
<div class="editor-content-image" data-image="">
|
|
145
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
146
|
+
</div>
|
|
147
|
+
`);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it("renders images without links correctly", async () => {
|
|
151
|
+
editorElement.focus();
|
|
152
|
+
editor.commands.setImage({ src: "/path/to/image.jpg", alt: "Test image" });
|
|
153
|
+
await sleep(0);
|
|
154
|
+
|
|
155
|
+
expect(editor.getHTML()).toMatchHtml(`
|
|
156
|
+
<div class="editor-content-image" data-image="">
|
|
157
|
+
<img src="/path/to/image.jpg" alt="Test image">
|
|
158
|
+
</div>
|
|
159
|
+
`);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -106,4 +106,21 @@
|
|
|
106
106
|
.editor-indent-10 {
|
|
107
107
|
@apply ml-40;
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
// Style for external link icon inside linked images
|
|
111
|
+
a:has(.editor-content-image) [data-external-link="true"] {
|
|
112
|
+
@apply block relative;
|
|
113
|
+
|
|
114
|
+
margin: -1.5rem 0 1em auto;
|
|
115
|
+
width: fit-content;
|
|
116
|
+
|
|
117
|
+
svg {
|
|
118
|
+
@apply w-4 h-4;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Make sure the anchor with image is positioned for proper icon placement
|
|
123
|
+
a:has(.editor-content-image) {
|
|
124
|
+
@apply block relative;
|
|
125
|
+
}
|
|
109
126
|
}
|
|
@@ -130,6 +130,16 @@
|
|
|
130
130
|
[data-image-resizer-wrapper] {
|
|
131
131
|
@apply relative inline-block;
|
|
132
132
|
|
|
133
|
+
[data-image-resizer-control],
|
|
134
|
+
[data-image-resizer-dimensions] {
|
|
135
|
+
z-index: 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
> a {
|
|
139
|
+
position: relative;
|
|
140
|
+
z-index: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
133
143
|
[data-image-resizer-control] {
|
|
134
144
|
@apply absolute hidden w-2.5 h-2.5 rounded-none border border-solid border-[#000] bg-[#fff] opacity-80;
|
|
135
145
|
}
|
|
@@ -29,7 +29,7 @@ module Decidim
|
|
|
29
29
|
delegate :content_tag, :safe_join, :link_to, :active_link_to_class, :is_active_link?, :icon, to: :@view
|
|
30
30
|
|
|
31
31
|
def render
|
|
32
|
-
content_tag :li, role:
|
|
32
|
+
content_tag :li, role: menuitem_role, class: link_wrapper_classes do
|
|
33
33
|
output = if url == "#"
|
|
34
34
|
[content_tag(:span, composed_label, class: "sidebar-menu__item-disabled")]
|
|
35
35
|
else
|
|
@@ -69,6 +69,12 @@ module Decidim
|
|
|
69
69
|
[@options.element_wrapper_class, active_class].compact.join(" ")
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
+
def menuitem_role
|
|
73
|
+
return if @options.role == false
|
|
74
|
+
|
|
75
|
+
@options.role || :menuitem
|
|
76
|
+
end
|
|
77
|
+
|
|
72
78
|
def active_class
|
|
73
79
|
active_link_to_class(
|
|
74
80
|
url,
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
<%= f.text_field :name, help_text: t("decidim.devise.registrations.new.username_help"), autocomplete: "name", placeholder: "John Doe" %>
|
|
35
35
|
|
|
36
36
|
<%= f.email_field :email, autocomplete: "email", placeholder: t("placeholder_email", scope: "decidim.devise.shared") %>
|
|
37
|
+
<span class="sr-only"><%= t("placeholder_email", scope: "decidim.devise.shared") %></span>
|
|
37
38
|
|
|
38
39
|
<%= render partial: "decidim/account/password_fields", locals: { form: f, user: :user } %>
|
|
39
40
|
</div>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<div id="card__tos" class="form__wrapper-block border-y-2">
|
|
2
2
|
<h2 class="h4"><%= t("decidim.devise.registrations.new.tos_title") %></h2>
|
|
3
|
+
<span class="sr-only"><%= t("forms.required") %></span>
|
|
3
4
|
|
|
4
|
-
<div>
|
|
5
|
+
<div id="terms_of_service_summary">
|
|
5
6
|
<% terms_of_service_summary_content_blocks.each do |content_block| %>
|
|
6
7
|
<%= cell content_block.manifest.cell, content_block %>
|
|
7
8
|
<% end %>
|
|
8
9
|
</div>
|
|
9
|
-
|
|
10
|
-
<%= form.check_box :tos_agreement, label: t("decidim.devise.registrations.new.tos_agreement", link: link_to(t("decidim.devise.registrations.new.terms"), decidim.page_path("terms-of-service"))), label_options: { class: "form__wrapper-checkbox-label" } %>
|
|
10
|
+
<%= form.check_box :tos_agreement, label: t("decidim.devise.registrations.new.tos_agreement", link: link_to(t("decidim.devise.registrations.new.terms"), decidim.page_path("terms-of-service"))), label_options: { class: "form__wrapper-checkbox-label" }, "aria-describedby": "terms_of_service_summary" %>
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
13
|
<div id="card__newsletter" class="form__wrapper-block">
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<blockquote>
|
|
17
17
|
<p>
|
|
18
|
-
<%= @event_instance.safe_resource_text %>
|
|
18
|
+
<%= decidim_transform_image_urls(@event_instance.safe_resource_text, @organization.host).html_safe %>
|
|
19
19
|
</p>
|
|
20
20
|
</blockquote>
|
|
21
21
|
<% end %>
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<p style="font-weight: bold"><%= t(".translated_text") %></p>
|
|
29
29
|
<blockquote>
|
|
30
30
|
<p>
|
|
31
|
-
<%= @event_instance.safe_resource_translated_text %>
|
|
31
|
+
<%= decidim_transform_image_urls(@event_instance.safe_resource_translated_text, @organization.host).html_safe %>
|
|
32
32
|
</p>
|
|
33
33
|
</blockquote>
|
|
34
34
|
<% end %>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<table>
|
|
41
41
|
<tr>
|
|
42
42
|
<td>
|
|
43
|
-
<%= link_to @event_instance.button_text, @event_instance.button_url, target: :blank %>
|
|
43
|
+
<%= link_to decidim_sanitize(@event_instance.button_text, strip_tags: true), @event_instance.button_url, target: :blank %>
|
|
44
44
|
</td>
|
|
45
45
|
</tr>
|
|
46
46
|
</table>
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
|
|
12
12
|
<div class="vertical-tabs">
|
|
13
13
|
<nav role="navigation" aria-label="<%= I18n.t("layouts.decidim.navigation.aria_label", title: translated_attribute(page.title)) %>">
|
|
14
|
-
<button id="dropdown-trigger-pages" data-controller="dropdown" data-target="dropdown-menu-pages" data-open-md="true" data-auto-close="true">
|
|
14
|
+
<button id="dropdown-trigger-pages" data-controller="dropdown" data-target="dropdown-menu-pages" data-open-md="true" data-auto-close="true" data-add-aria-roles="false">
|
|
15
15
|
<span>
|
|
16
16
|
<%= translated_attribute(page.title) %>
|
|
17
17
|
</span>
|
|
18
18
|
<%= icon "arrow-down-s-line" %>
|
|
19
19
|
<%= icon "arrow-up-s-line" %>
|
|
20
20
|
</button>
|
|
21
|
-
<ul id="dropdown-menu-pages" class="vertical-tabs__list"
|
|
21
|
+
<ul id="dropdown-menu-pages" class="vertical-tabs__list">
|
|
22
22
|
<% pages.each do |sibling| %>
|
|
23
|
-
<li class="<%= "is-active" if page == sibling %>"
|
|
23
|
+
<li class="<%= "is-active" if page == sibling %>">
|
|
24
24
|
<%= link_to translated_attribute(sibling.title), page_path(sibling.slug), "aria-current": ("page" if page == sibling) %>
|
|
25
25
|
</li>
|
|
26
26
|
<% end %>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<% search_label = t("decidim.searches.filters.search") unless local_assigns.has_key?(:search_label) %>
|
|
3
3
|
|
|
4
4
|
<% if filter_sections.present? || local_assigns.has_key?(:search_variable) %>
|
|
5
|
-
<%= filter_form_for filter, url_for, class: "new_filter self-stretch", data: { filters: "", controller: "accordion form-filter" } do |form| %>
|
|
5
|
+
<%= filter_form_for filter, url_for, class: "new_filter self-stretch", data: { filters: "", controller: "accordion form-filter", panel_role: "group" } do |form| %>
|
|
6
6
|
|
|
7
|
-
<button id="dropdown-trigger-filters" data-controller="dropdown" data-target="dropdown-menu-filters" data-open-md="true">
|
|
7
|
+
<button id="dropdown-trigger-filters" data-controller="dropdown" data-target="dropdown-menu-filters" data-open-md="true" data-add-aria-roles="false">
|
|
8
8
|
<%= icon "arrow-down-s-line" %>
|
|
9
9
|
<%= icon "arrow-up-s-line" %>
|
|
10
10
|
<span>
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
<div id="dropdown-menu-filters">
|
|
16
16
|
<% if local_assigns.has_key?(:skip_to_id) %>
|
|
17
|
-
<%= link_to t("skip", scope: "decidim.shared.filter_form_help"), "##{skip_to_id}", class: "filter-skip",
|
|
17
|
+
<%= link_to t("skip", scope: "decidim.shared.filter_form_help"), "##{skip_to_id}", class: "filter-skip", "data-skip-to-content": true %>
|
|
18
18
|
<% end %>
|
|
19
19
|
|
|
20
|
-
<p id="filter-help-text" class="filter-help"
|
|
20
|
+
<p id="filter-help-text" class="filter-help" aria-disabled="true"><%= t("help", scope: "decidim.shared.filter_form_help") %></p>
|
|
21
21
|
|
|
22
22
|
<% if local_assigns.has_key?(:search_variable) %>
|
|
23
|
-
<div class="filter-search filter-container"
|
|
23
|
+
<div class="filter-search filter-container">
|
|
24
24
|
<%= form.search_field search_variable,
|
|
25
25
|
label: false,
|
|
26
26
|
placeholder: search_label,
|