fix cursor on disabled composer

This commit is contained in:
Neil Lalonde 2018-04-12 11:32:05 -04:00
parent f4ebe47b32
commit 0e2584b841
4 changed files with 13 additions and 17 deletions

View File

@ -9,8 +9,8 @@
</div> </div>
<div class='d-editor-container'> <div class='d-editor-container'>
<div class="d-editor-textarea-wrapper"> <div class="d-editor-textarea-wrapper {{if disabled "disabled"}}">
<div class='d-editor-button-bar {{if disabled "disabled"}}'> <div class='d-editor-button-bar'>
{{#each toolbar.groups as |group|}} {{#each toolbar.groups as |group|}}
{{#each group.buttons as |b|}} {{#each group.buttons as |b|}}
{{#if b.popupMenu}} {{#if b.popupMenu}}

View File

@ -57,6 +57,12 @@
background: transparent; background: transparent;
} }
&.disabled {
cursor: not-allowed;
.d-editor-button-bar {
visibility: hidden;
}
}
} }
.d-editor-preview-wrapper { .d-editor-preview-wrapper {
@ -90,11 +96,6 @@
.btn.italic { .btn.italic {
font-style: italic; font-style: italic;
} }
&.disabled {
visibility: hidden;
cursor: not-allowed;
}
} }
.d-editor-spacer { .d-editor-spacer {

View File

@ -353,8 +353,7 @@ QUnit.test("Disable body until category is selected", assert => {
assert.ok(exists('.d-editor-input'), 'the composer input is visible'); assert.ok(exists('.d-editor-input'), 'the composer input is visible');
assert.ok(exists('.title-input .popup-tip.bad.hide'), 'title errors are hidden by default'); assert.ok(exists('.title-input .popup-tip.bad.hide'), 'title errors are hidden by default');
assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default'); assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default');
assert.ok(exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is disabled'); assert.ok(exists('.d-editor-textarea-wrapper.disabled'), 'textarea is disabled');
assert.ok(find('.d-editor-container .d-editor-input:disabled').length, 'textarea is disabled');
}); });
const categoryChooser = selectKit('.category-chooser'); const categoryChooser = selectKit('.category-chooser');
@ -362,15 +361,13 @@ QUnit.test("Disable body until category is selected", assert => {
categoryChooser.expand().selectRowByValue(2); categoryChooser.expand().selectRowByValue(2);
andThen(() => { andThen(() => {
assert.ok(!exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is enabled'); assert.ok(find('.d-editor-textarea-wrapper.disabled').length === 0, 'textarea is enabled');
assert.ok(find('.d-editor-container .d-editor-input:disabled').length === 0, 'textarea is enabled');
}); });
fillIn('.d-editor-input', 'Now I can type stuff'); fillIn('.d-editor-input', 'Now I can type stuff');
categoryChooser.expand().selectRowByValue('__none__'); categoryChooser.expand().selectRowByValue('__none__');
andThen(() => { andThen(() => {
assert.ok(!exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is still enabled'); assert.ok(find('.d-editor-textarea-wrapper.disabled').length === 0, 'textarea is still enabled');
assert.ok(find('.d-editor-container .d-editor-input:disabled').length === 0, 'textarea is still enabled');
}); });
}); });

View File

@ -93,15 +93,13 @@ QUnit.test("Pasting a link enables the text input area", assert => {
visit("/"); visit("/");
click('#create-topic'); click('#create-topic');
andThen(() => { andThen(() => {
assert.ok(exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is disabled'); assert.ok(find('.d-editor-textarea-wrapper.disabled').length, 'textarea is disabled');
assert.ok(find('.d-editor-container .d-editor-input:disabled').length, 'textarea is disabled');
}); });
fillIn('#reply-title', "http://www.example.com/has-title.html"); fillIn('#reply-title', "http://www.example.com/has-title.html");
andThen(() => { andThen(() => {
assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it"); assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good'); assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
assert.equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article"); assert.equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article");
assert.ok(!exists('.d-editor-container .d-editor-button-bar.disabled'), 'toolbar is enabled'); assert.ok(find('.d-editor-textarea-wrapper.disabled').length === 0, 'textarea is enabled');
assert.ok(find('.d-editor-container .d-editor-input:disabled').length === 0, 'textarea is enabled');
}); });
}); });