From 838f7e56a407aa335cf4406632373bac3d05dee0 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Sat, 23 Mar 2019 14:09:14 +0100 Subject: Remove .wiki and @md-typography mixin in favor of .md and .md-file Before, the styling for `img:not(.emoji)`` was repeated between `.md:not(.use-csslab):not(.wiki)` (for comments and the Markdown preview), `.documentation.wiki` (for help pages), and `.issuable-details .description .wiki` (for MR and issue descriptions). In these places, we now simply use `.md`. Wherever we use `.md` but don't want this image styling (like wikis and blobs), `.md-file` is added. --- .../javascripts/behaviors/markdown/copy_as_gfm.js | 4 +-- .../behaviors/shortcuts/shortcuts_issuable.js | 4 +-- .../issue_show/components/description.vue | 2 +- app/assets/stylesheets/framework/files.scss | 2 +- app/assets/stylesheets/framework/typography.scss | 36 ++++++++-------------- app/assets/stylesheets/pages/help.scss | 8 ----- app/assets/stylesheets/pages/issuable.scss | 8 ----- app/assets/stylesheets/pages/wiki.scss | 6 ---- app/assets/stylesheets/print.scss | 18 +++++------ app/views/help/index.html.haml | 2 +- app/views/help/instance_configuration.html.haml | 2 +- app/views/help/show.html.haml | 2 +- app/views/help/ui.html.haml | 2 +- app/views/projects/_wiki.html.haml | 5 ++- app/views/projects/blob/preview.html.haml | 2 +- app/views/projects/blob/viewers/_markup.html.haml | 2 +- app/views/projects/issues/show.html.haml | 2 +- .../projects/merge_requests/_mr_box.html.haml | 2 +- app/views/projects/milestones/show.html.haml | 5 ++- app/views/projects/tags/_tag.html.haml | 5 ++- app/views/projects/tags/show.html.haml | 5 ++- app/views/projects/wikis/show.html.haml | 2 +- app/views/search/results/_snippet_blob.html.haml | 2 +- app/views/shared/milestones/_top.html.haml | 5 ++- app/views/shared/snippets/_header.html.haml | 2 +- .../user_views_open_merge_request_spec.rb | 2 +- .../projects/wiki/user_creates_wiki_page_spec.rb | 2 +- spec/features/task_lists_spec.rb | 8 ++--- .../fixtures/static/merge_requests_show.html.raw | 2 +- spec/javascripts/issue_show/components/app_spec.js | 4 +-- .../issue_show/components/description_spec.js | 4 +-- spec/support/matchers/issuable_matchers.rb | 2 +- 32 files changed, 61 insertions(+), 98 deletions(-) diff --git a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js index 58cf057b2c2..83d4196d0aa 100644 --- a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js +++ b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js @@ -10,7 +10,7 @@ export class CopyAsGFM { const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); if (isIOS) return; - $(document).on('copy', '.md, .wiki', e => { + $(document).on('copy', '.md', e => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); }); $(document).on('copy', 'pre.code.highlight, .diff-content .line_content', e => { @@ -99,7 +99,7 @@ export class CopyAsGFM { } static transformGFMSelection(documentFragment) { - const gfmElements = documentFragment.querySelectorAll('.md, .wiki'); + const gfmElements = documentFragment.querySelectorAll('.md'); switch (gfmElements.length) { case 0: { return documentFragment; diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js index 680f2031409..670f66b005e 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js @@ -37,7 +37,7 @@ export default class ShortcutsIssuable extends Shortcuts { } // Sanity check: Make sure the selected text comes from a discussion : it can either contain a message... - let foundMessage = !!documentFragment.querySelector('.md, .wiki'); + let foundMessage = !!documentFragment.querySelector('.md'); // ... Or come from a message if (!foundMessage) { @@ -46,7 +46,7 @@ export default class ShortcutsIssuable extends Shortcuts { let node = e; do { // Text nodes don't define the `matches` method - if (node.matches && node.matches('.md, .wiki')) { + if (node.matches && node.matches('.md')) { foundMessage = true; } node = node.parentNode; diff --git a/app/assets/javascripts/issue_show/components/description.vue b/app/assets/javascripts/issue_show/components/description.vue index 58f14bac8c8..732184dc782 100644 --- a/app/assets/javascripts/issue_show/components/description.vue +++ b/app/assets/javascripts/issue_show/components/description.vue @@ -140,7 +140,7 @@ export default { 'issue-realtime-pre-pulse': preAnimation, 'issue-realtime-trigger-pulse': pulseAnimation, }" - class="wiki" + class="md" v-html="descriptionHtml" >