Skip to content

Commit

Permalink
UX: remove 🔥heading and ruler button from composer toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ZogStriP committed Oct 20, 2017
1 parent 4205c1a commit 6215688
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 82 deletions.
18 changes: 0 additions & 18 deletions app/assets/javascripts/discourse/components/d-editor.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,6 @@ class Toolbar {
perform: e => e.applyList(i => !i ? "1. " : `${parseInt(i) + 1}. `, 'list_item')
});

this.addButton({
id: 'heading',
group: 'extras',
icon: 'header',
label: getButtonLabel('composer.heading_label', 'H'),
shortcut: 'Alt+1',
perform: e => e.applyList('## ', 'heading_text')
});

this.addButton({
id: 'rule',
group: 'extras',
icon: 'minus',
shortcut: 'Alt+R',
title: 'composer.hr_title',
perform: e => e.addText("\n\n----------\n")
});

if (site.mobileView) {
this.groups.push({group: 'mobileExtras', buttons: []});
}
Expand Down
4 changes: 0 additions & 4 deletions config/locales/client.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,6 @@ en:
olist_title: "Numbered List"
ulist_title: "Bulleted List"
list_item: "List item"
heading_label: "H"
heading_title: "Heading"
heading_text: "Heading"
hr_title: "Horizontal Rule"
help: "Markdown Editing Help"
toggler: "hide or show the composer panel"
modal_ok: "OK"
Expand Down
60 changes: 0 additions & 60 deletions test/javascripts/components/d-editor-test.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -692,66 +692,6 @@ testCase(`list button with line sequence`, function(assert, textarea) {
});
});

testCase(`heading button with no selection`, function(assert, textarea) {
const example = I18n.t('composer.heading_text');

click(`button.heading`);
andThen(() => {
assert.equal(this.get('value'), `hello world.\n\n## ${example}`);
assert.equal(textarea.selectionStart, 14);
assert.equal(textarea.selectionEnd, 17 + example.length);
});

textarea.selectionStart = 30;
textarea.selectionEnd = 30;
click(`button.heading`);
andThen(() => {
assert.equal(this.get('value'), `hello world.\n\n${example}`);
assert.equal(textarea.selectionStart, 14);
assert.equal(textarea.selectionEnd, 14 + example.length);
});
});

testCase(`rule between things`, function(assert, textarea) {
textarea.selectionStart = 5;
textarea.selectionEnd = 5;

click(`button.rule`);
andThen(() => {
assert.equal(this.get('value'), `hello\n\n----------\n world.`);
assert.equal(textarea.selectionStart, 18);
assert.equal(textarea.selectionEnd, 18);
});
});

testCase(`rule with no selection`, function(assert, textarea) {
click(`button.rule`);
andThen(() => {
assert.equal(this.get('value'), `hello world.\n\n----------\n`);
assert.equal(textarea.selectionStart, 25);
assert.equal(textarea.selectionEnd, 25);
});

click(`button.rule`);
andThen(() => {
assert.equal(this.get('value'), `hello world.\n\n----------\n\n\n----------\n`);
assert.equal(textarea.selectionStart, 38);
assert.equal(textarea.selectionEnd, 38);
});
});

testCase(`rule with a selection`, function(assert, textarea) {
textarea.selectionStart = 6;
textarea.selectionEnd = 11;

click(`button.rule`);
andThen(() => {
assert.equal(this.get('value'), `hello \n\n----------\n.`);
assert.equal(textarea.selectionStart, 19);
assert.equal(textarea.selectionEnd, 19);
});
});

testCase(`doesn't jump to bottom with long text`, function(assert, textarea) {

let longText = 'hello world.';
Expand Down

1 comment on commit 6215688

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.