Feature #43259 » 0001-Introduce-semantic-wiki-toolbar-CSS-classes-and-depr.patch
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
color: var(--oc-red-9);
|
||
|
}
|
||
|
.tabular label.error + *:not(#issue_description_and_toolbar), .tabular label.error + div#issue_description_and_toolbar div.jstBlock {
|
||
|
.tabular label.error + *:not(#issue_description_and_toolbar), .tabular label.error + div#issue_description_and_toolbar div.wiki-toolbar {
|
||
|
border: 1px solid var(--oc-red-9);
|
||
|
}
|
||
| ... | ... | |
|
input#time_entry_comments { inline-size: 90%;}
|
||
|
input#months { inline-size: 46px; }
|
||
|
.jstBlock .jstTabs, .jstBlock .wiki-preview { inline-size: 99%; }
|
||
|
.wiki-toolbar .wiki-toolbar-tabs, .wiki-toolbar .wiki-preview { inline-size: 99%; }
|
||
|
.jstBlock .jstTabs { padding-inline-end: 6px; }
|
||
|
.jstBlock .wiki-preview { padding: 2px; }
|
||
|
.jstBlock .wiki-preview > p:first-child { padding-block-start: 0 !important; margin-block-start: 0 !important;}
|
||
|
.jstBlock .wiki-preview > p:last-child { padding-block-end: 0 !important; margin-block-end: 0 !important;}
|
||
|
.wiki-toolbar .wiki-toolbar-tabs { padding-inline-end: 6px; }
|
||
|
.wiki-toolbar .wiki-preview { padding: 2px; }
|
||
|
.wiki-toolbar .wiki-preview > p:first-child { padding-block-start: 0 !important; margin-block-start: 0 !important;}
|
||
|
.wiki-toolbar .wiki-preview > p:last-child { padding-block-end: 0 !important; margin-block-end: 0 !important;}
|
||
|
.tabular .wiki-preview, .tabular .jstTabs {inline-size: 95%;}
|
||
|
.tabular.settings .wiki-preview, .tabular.settings .jstTabs { inline-size: 99%; }
|
||
|
.tabular .wiki-preview, .tabular .wiki-toolbar-tabs {inline-size: 95%;}
|
||
|
.tabular.settings .wiki-preview, .tabular.settings .wiki-toolbar-tabs { inline-size: 99%; }
|
||
|
.tabular.settings .wiki-preview p {padding-inline-start: 0 !important}
|
||
|
.tabular .wiki-preview p {
|
||
|
min-block-size: initial;
|
||
| ... | ... | |
|
.tabular.settings p, .tabular.settings div.form-field { padding-inline-start: 300px; font-size: 93%; }
|
||
|
.tabular.settings label{ margin-inline-start: -300px; inline-size: 295px; }
|
||
|
.tabular.settings textarea, .tabular.settings .wiki-preview, .tabular.settings .jstTabs { inline-size: 99%; }
|
||
|
.tabular.settings textarea, .tabular.settings .wiki-preview, .tabular.settings .wiki-toolbar-tabs { inline-size: 99%; }
|
||
|
.settings.enabled_scm table {width:100%}
|
||
|
.settings.enabled_scm td.scm_name{ font-weight: bold; }
|
||
| app/assets/stylesheets/jstoolbar.css | ||
|---|---|---|
|
* This code is released under the GNU General Public License.
|
||
|
*/
|
||
|
.jstBlock .hidden {
|
||
|
/* Deprecated jst* aliases (jstBlock, jstTabs, jstEditor, jstElements, jstSpacer, jstMenu, jstb_*)
|
||
|
* are still emitted in HTML for third-party theme/plugin compatibility. */
|
||
|
.wiki-toolbar .hidden {
|
||
|
display: none;
|
||
|
}
|
||
|
.jstEditor {
|
||
|
.wiki-toolbar-editor {
|
||
|
padding-inline-start: 0px;
|
||
|
}
|
||
|
.jstEditor textarea, .jstEditor iframe {
|
||
|
.wiki-toolbar-editor textarea, .wiki-toolbar-editor iframe {
|
||
|
margin: 0;
|
||
|
}
|
||
|
.jstHandle {
|
||
| ... | ... | |
|
cursor: s-resize;
|
||
|
/*background: transparent url(img/resizer.png) no-repeat 45% 50%;*/
|
||
|
}
|
||
|
#content .jstTabs.tabs {
|
||
|
#content .wiki-toolbar-tabs.tabs {
|
||
|
margin-block-end: -1px;
|
||
|
}
|
||
|
#content .jstTabs.tabs ul {border-block-end: 0;}
|
||
|
#content .jstTabs.tabs li {
|
||
|
#content .wiki-toolbar-tabs.tabs ul {border-block-end: 0;}
|
||
|
#content .wiki-toolbar-tabs.tabs li {
|
||
|
block-size: 42px;
|
||
|
}
|
||
|
#content .jstTabs.tabs li:before{
|
||
|
#content .wiki-toolbar-tabs.tabs li:before{
|
||
|
content: '';
|
||
|
display: inline-block;
|
||
|
vertical-align: middle;
|
||
|
block-size: 100%;
|
||
|
}
|
||
|
#content .jstTabs.tabs li a {
|
||
|
#content .wiki-toolbar-tabs.tabs li a {
|
||
|
display: inline-block;
|
||
|
vertical-align: bottom;
|
||
|
line-height: 19px;
|
||
|
border-block-end: 1px solid transparent;
|
||
|
}
|
||
|
.jstElements {
|
||
|
.wiki-toolbar-buttons {
|
||
|
display: inline-block;
|
||
|
vertical-align: bottom;
|
||
|
padding-inline-start: 6px;
|
||
| ... | ... | |
|
}
|
||
|
.wiki-preview p.empty-preview {color: var(--color-text-muted); font-style: italic; margin-block-start: 1em; text-align: center;}
|
||
|
.jstElements button {
|
||
|
.wiki-toolbar-buttons button {
|
||
|
margin-inline-end: 2px;
|
||
|
inline-size : 24px;
|
||
|
block-size: 24px;
|
||
| ... | ... | |
|
cursor:pointer;
|
||
|
opacity:0.7;
|
||
|
}
|
||
|
.jstElements button:hover {
|
||
|
.wiki-toolbar-buttons button:hover {
|
||
|
border-color: var(--oc-gray-5);
|
||
|
background-color: var(--oc-gray-3);
|
||
|
opacity:1;
|
||
|
}
|
||
|
.jstElements button span {
|
||
|
.wiki-toolbar-buttons button span {
|
||
|
display : none;
|
||
|
}
|
||
|
.jstElements span {
|
||
|
.wiki-toolbar-buttons span {
|
||
|
display : inline;
|
||
|
}
|
||
|
.jstSpacer {
|
||
|
.wiki-toolbar-spacer {
|
||
|
inline-size : 0px;
|
||
|
font-size: 1px;
|
||
|
margin-inline-end: 6px;
|
||
|
}
|
||
|
.jstElements .help { float: inline-end; margin-inline-end: 0.5em; padding-block-start: 8px; font-size: 0.9em; }
|
||
|
.jstElements .help a {padding-block: 2px; padding-inline-start: 20px; padding-inline-end: 0; background: url(./help.png) no-repeat 0 50%;}
|
||
|
.wiki-toolbar-buttons .help { float: inline-end; margin-inline-end: 0.5em; padding-block-start: 8px; font-size: 0.9em; }
|
||
|
.wiki-toolbar-buttons .help a {padding-block: 2px; padding-inline-start: 20px; padding-inline-end: 0; background: url(./help.png) no-repeat 0 50%;}
|
||
|
.table-generator td {
|
||
|
border: 1px solid var(--oc-gray-4);
|
||
| ... | ... | |
|
}
|
||
|
/* Menus opened by the toolbar buttons, positioned by wiki_toolbar_controller.js */
|
||
|
.jstBlock > [popover] {
|
||
|
.wiki-toolbar > [popover] {
|
||
|
position: absolute;
|
||
|
inset: auto;
|
||
|
margin: 0;
|
||
|
}
|
||
|
/* Resets the user agent styles of popovers without overriding the menu styles */
|
||
|
:where(.jstBlock > [popover]) {
|
||
|
:where(.wiki-toolbar > [popover]) {
|
||
|
padding: 0;
|
||
|
border: 0;
|
||
|
overflow: visible;
|
||
| ... | ... | |
|
padding-inline: 4px; /* .dropdown-content sets the block padding */
|
||
|
}
|
||
|
.jstMenu {
|
||
|
.wiki-toolbar-menu {
|
||
|
max-block-size: 300px;
|
||
|
overflow-y: auto;
|
||
|
/* Same as the context menu, regardless of the line height of the form (e.g. .box) */
|
||
| ... | ... | |
|
/* Buttons
|
||
|
-------------------------------------------------------- */
|
||
|
.jstb_strong {
|
||
|
.wiki-toolbar-button-strong {
|
||
|
background-image: url(/jstoolbar/bold.svg);
|
||
|
}
|
||
|
.jstb_em {
|
||
|
.wiki-toolbar-button-em {
|
||
|
background-image: url(/jstoolbar/italic.svg);
|
||
|
}
|
||
|
.jstb_ins {
|
||
|
.wiki-toolbar-button-ins {
|
||
|
background-image: url(/jstoolbar/underline.svg);
|
||
|
}
|
||
|
.jstb_del {
|
||
|
.wiki-toolbar-button-del {
|
||
|
background-image: url(/jstoolbar/strikethrough.svg);
|
||
|
}
|
||
|
.jstb_code {
|
||
|
.wiki-toolbar-button-code {
|
||
|
background-image: url(/jstoolbar/letter-c.svg);
|
||
|
}
|
||
|
.jstb_h1 {
|
||
|
.wiki-toolbar-button-h1 {
|
||
|
background-image: url(/jstoolbar/h1.svg);
|
||
|
}
|
||
|
.jstb_h2 {
|
||
|
.wiki-toolbar-button-h2 {
|
||
|
background-image: url(/jstoolbar/h2.svg);
|
||
|
}
|
||
|
.jstb_h3 {
|
||
|
.wiki-toolbar-button-h3 {
|
||
|
background-image: url(/jstoolbar/h3.svg);
|
||
|
}
|
||
|
.jstb_ul {
|
||
|
.wiki-toolbar-button-ul {
|
||
|
background-image: url(/jstoolbar/list.svg);
|
||
|
}
|
||
|
.jstb_ol {
|
||
|
.wiki-toolbar-button-ol {
|
||
|
background-image: url(/jstoolbar/list-numbers.svg);
|
||
|
}
|
||
|
.jstb_tl {
|
||
|
.wiki-toolbar-button-tl {
|
||
|
background-image: url(/jstoolbar/list-check.svg);
|
||
|
}
|
||
|
.jstb_bq {
|
||
|
.wiki-toolbar-button-bq {
|
||
|
background-image: url(/jstoolbar/indent-increase.svg);
|
||
|
}
|
||
|
.jstb_unbq {
|
||
|
.wiki-toolbar-button-unbq {
|
||
|
background-image: url(/jstoolbar/indent-decrease.svg);
|
||
|
}
|
||
|
.jstb_pre::before {
|
||
|
.wiki-toolbar-button-pre::before {
|
||
|
content: "pre";
|
||
|
font-size: 10px;
|
||
|
color: var(--oc-gray-9);
|
||
|
font-weight: 700
|
||
|
}
|
||
|
.jstb_precode {
|
||
|
.wiki-toolbar-button-precode {
|
||
|
background-image: url(/jstoolbar/code.svg);
|
||
|
}
|
||
|
.jstb_link {
|
||
|
.wiki-toolbar-button-link {
|
||
|
background-image: url(/jstoolbar/wiki_link.svg);
|
||
|
}
|
||
|
.jstb_img {
|
||
|
.wiki-toolbar-button-img {
|
||
|
background-image: url(/jstoolbar/image.svg);
|
||
|
}
|
||
|
.jstb_table {
|
||
|
.wiki-toolbar-button-table {
|
||
|
background-image: url(/jstoolbar/table.svg);
|
||
|
}
|
||
|
.jstb_help {
|
||
|
.wiki-toolbar-button-help {
|
||
|
background-image: url(/jstoolbar/help.svg);
|
||
|
}
|
||
| app/javascript/controllers/wiki_toolbar_controller.js | ||
|---|---|---|
|
if (event.target === this.field) {
|
||
|
event.preventDefault()
|
||
|
this.preview()
|
||
|
} else if (this.constructor.lastPreviewed === this && !event.target.closest?.('.jstEditor')) {
|
||
|
} else if (this.constructor.lastPreviewed === this && !event.target.closest?.('.wiki-toolbar-editor, .jstEditor')) {
|
||
|
event.preventDefault()
|
||
|
this.constructor.lastPreviewed = null
|
||
|
this.edit()
|
||
| app/views/wiki_toolbar/_buttons.html.erb | ||
|---|---|---|
|
<%# The jst* classes (jstElements, jstSpacer, jstb_*) are deprecated and kept for theme/plugin compatibility. %>
|
||
|
<% buttons = Redmine::WikiToolbar.buttons(Setting.text_formatting) %>
|
||
|
<% cache ['wiki_toolbar_buttons', Setting.text_formatting, current_language, buttons] do %>
|
||
|
<div class="jstElements" data-wiki-toolbar-target="toolbar">
|
||
|
<div class="wiki-toolbar-buttons jstElements" data-wiki-toolbar-target="toolbar">
|
||
|
<% buttons.each_with_index do |names, index| %>
|
||
|
<% if index > 0 %><span class="jstSpacer"> </span><% end %>
|
||
|
<% if index > 0 %><span class="wiki-toolbar-spacer jstSpacer"> </span><% end %>
|
||
|
<% names.each do |name| %>
|
||
|
<% title = l(Redmine::WikiToolbar.label_for(name)) %>
|
||
|
<%= tag.button tag.span(title), type: 'button', class: "jstb_#{name}", title: title, tabindex: 200,
|
||
|
<%= tag.button tag.span(title), type: 'button', class: "wiki-toolbar-button-#{name} jstb_#{name}", title: title, tabindex: 200,
|
||
|
aria: ({haspopup: true, expanded: false} if Redmine::WikiToolbar.menus.include?(name)),
|
||
|
data: wiki_toolbar_button_data(name) %>
|
||
|
<% end %>
|
||
| app/views/wiki_toolbar/_menus.html.erb | ||
|---|---|---|
|
<% languages = User.current.pref.toolbar_language_options.to_s.split(',') %>
|
||
|
<% cache ['wiki_toolbar_menus', languages] do %>
|
||
|
<template data-wiki-toolbar-menu="precode">
|
||
|
<ul class="jstMenu dropdown-content" role="menu" popover="auto"
|
||
|
<ul class="wiki-toolbar-menu jstMenu dropdown-content" role="menu" popover="auto"
|
||
|
data-action="click->wiki-toolbar#closeMenu keydown->wiki-toolbar#navigateMenu">
|
||
|
<% languages.each do |lang| %>
|
||
|
<li role="none">
|
||
| app/views/wiki_toolbar/_toolbar.html.erb | ||
|---|---|---|
|
<%# Wiki toolbar rendered around the field (the textarea), see WikiToolbarHelper#wiki_toolbar %>
|
||
|
<%# Wiki toolbar rendered around the field (the textarea), see WikiToolbarHelper#wiki_toolbar.
|
||
|
The jst* classes (jstBlock, jstTabs, jstEditor) are deprecated and kept for theme/plugin compatibility. %>
|
||
|
<% syntax = Redmine::WikiToolbar.syntax_for(Setting.text_formatting) %>
|
||
|
<% toolbar = local_assigns.fetch(:toolbar, true) %>
|
||
|
<% shortcuts = Redmine::WikiToolbar.shortcuts_for(Setting.text_formatting) %>
|
||
|
<%= tag.div class: 'jstBlock', hidden: local_assigns[:adopt_field],
|
||
|
<%= tag.div class: 'wiki-toolbar jstBlock', hidden: local_assigns[:adopt_field],
|
||
|
data: {
|
||
|
controller: 'wiki-toolbar',
|
||
|
action: [
|
||
| ... | ... | |
|
wiki_toolbar_field_id_value: (field_id if local_assigns[:adopt_field])
|
||
|
} do %>
|
||
|
<% if toolbar %>
|
||
|
<div class="jstTabs tabs">
|
||
|
<div class="wiki-toolbar-tabs jstTabs tabs">
|
||
|
<ul role="tablist">
|
||
|
<li>
|
||
|
<%= link_to l(:button_edit), '#', class: 'tab-edit selected', role: 'tab', aria: {selected: true},
|
||
| ... | ... | |
|
</ul>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
<div class="jstEditor" data-wiki-toolbar-target="editor">
|
||
|
<div class="wiki-toolbar-editor jstEditor" data-wiki-toolbar-target="editor">
|
||
|
<%= field %>
|
||
|
<% if toolbar %>
|
||
|
<%= tag.div class: 'wiki wiki-preview hidden', id: "preview_#{field_id}", data: {wiki_toolbar_target: 'preview'} %>
|
||
| test/helpers/wiki_toolbar_helper_test.rb | ||
|---|---|---|
|
with_settings :text_formatting => 'common_mark' do
|
||
|
html = render_erb("<%= wiki_textarea_tag('content[text]', 'Hello', :rows => 5, :preview_url => '/preview', :data => {:auto_complete => true}) %>")
|
||
|
assert_select_in html, 'div.jstBlock[data-controller=wiki-toolbar]:not([hidden]):not([data-wiki-toolbar-field-id-value])' do
|
||
|
assert_select_in html, 'div.wiki-toolbar.jstBlock[data-controller=wiki-toolbar]:not([hidden]):not([data-wiki-toolbar-field-id-value])' do
|
||
|
assert_select '[data-wiki-toolbar-format-value=common_mark]'
|
||
|
assert_select '[data-wiki-toolbar-preview-url-value=?]', '/preview'
|
||
|
assert_select '[data-wiki-toolbar-help-url-value=?]', '/help/wiki_syntax'
|
||
|
assert_select 'div.jstTabs ul[role=tablist]' do
|
||
|
assert_select 'div.wiki-toolbar-tabs.jstTabs ul[role=tablist]' do
|
||
|
assert_select 'a.tab-edit.selected[aria-selected=true]', :text => 'Edit'
|
||
|
assert_select 'a.tab-preview[aria-selected=false]', :text => 'Preview'
|
||
|
assert_select 'div.jstElements'
|
||
|
assert_select 'div.wiki-toolbar-buttons.jstElements'
|
||
|
end
|
||
|
assert_select 'div.jstEditor' do
|
||
|
assert_select 'div.wiki-toolbar-editor.jstEditor' do
|
||
|
assert_select 'textarea#content_text.wiki-edit[name=?][rows="5"][data-wiki-toolbar-target=field][data-auto-complete=true]',
|
||
|
'content[text]', :text => 'Hello'
|
||
|
assert_select 'textarea + div.wiki-preview.hidden#preview_content_text[data-wiki-toolbar-target=preview]'
|
||
| ... | ... | |
|
with_settings :text_formatting => 'common_mark' do
|
||
|
html = render_erb("<%= wiki_textarea_tag('notes') %>")
|
||
|
assert_select_in html, 'div.jstElements' do
|
||
|
assert_select_in html, 'div.wiki-toolbar-buttons.jstElements' do
|
||
|
assert_select 'button', 19
|
||
|
assert_select 'span.jstSpacer', 5
|
||
|
assert_select 'button.jstb_strong[title=?][data-action=?][data-wiki-toolbar-button-param=strong][data-wiki-toolbar-shortcut=b]:not([aria-haspopup])',
|
||
|
assert_select 'span.wiki-toolbar-spacer.jstSpacer', 5
|
||
|
assert_select 'button.wiki-toolbar-button-strong.jstb_strong[title=?][data-action=?][data-wiki-toolbar-button-param=strong][data-wiki-toolbar-shortcut=b]:not([aria-haspopup])',
|
||
|
'Strong', 'wiki-toolbar#apply'
|
||
|
assert_select 'button.jstb_tl[data-wiki-toolbar-button-param=tl]'
|
||
|
assert_select 'button.jstb_table[aria-haspopup=true][aria-expanded=false][data-action=?][data-wiki-toolbar-menu-param=table]', 'wiki-toolbar#toggleMenu'
|
||
| ... | ... | |
|
with_settings :text_formatting => 'textile' do
|
||
|
html = render_erb("<%= wiki_textarea_tag('notes') %>")
|
||
|
assert_select_in html, 'template[data-wiki-toolbar-menu=precode] ul.jstMenu.dropdown-content[role=menu][popover=auto]' do
|
||
|
assert_select_in html, 'template[data-wiki-toolbar-menu=precode] ul.wiki-toolbar-menu.jstMenu.dropdown-content[role=menu][popover=auto]' do
|
||
|
assert_select 'button.dropdown-item[role=menuitem][tabindex="-1"]', 2
|
||
|
end
|
||
|
assert_select_in html, 'ul.jstMenu button[data-action=?][data-wiki-toolbar-lang-param=ruby]', 'wiki-toolbar#insertPrecode',
|
||
- « Previous
- 1
- …
- 12
- 13
- 14
- Next »