Skip to content

Commit

Permalink
Fixed toolbarFixed
Browse files Browse the repository at this point in the history
fixes #9
  • Loading branch information
brandonkelly committed Mar 30, 2018
1 parent 059335f commit 134217a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ Changelog
### Fixed
- Fixed a bug where empty field values would still normalize to a `craft\redactor\FieldData` object, rather than `null`.
- Fixed a deprecation error when running Redactor on Craft 3.0.0-RC15 or later.
- Fixed support for Redactor’s `fixedToolbar` option. ([#9](https://github.com/craftcms/redactor/issues/9))

## 1.0.1 - 2018-01-15

Expand Down
9 changes: 8 additions & 1 deletion src/assets/field/dist/js/RedactorInput.js
Expand Up @@ -38,7 +38,6 @@
this.redactorConfig.fileUpload = true;
this.redactorConfig.dragImageUpload = false;
this.redactorConfig.dragFileUpload = false;
this.redactorConfig.toolbarFixedTopOffset = 72;

// Prevent a JS error when calling core.destroy() when opts.plugins == false
if (typeof this.redactorConfig.plugins !== typeof []) {
Expand Down Expand Up @@ -108,6 +107,14 @@
},

initRedactor: function() {
if (this.redactorConfig.toolbarFixed) {
// Set the toolbarFixedTarget depending on the context
var target = this.$textarea.closest('#content-container, .lp-editor');
if (target.length) {
this.redactorConfig.toolbarFixedTarget = target;
}
}

Craft.RedactorInput.currentInstance = this;
this.$textarea.redactor(this.redactorConfig);
delete Craft.RedactorInput.currentInstance;
Expand Down
2 changes: 1 addition & 1 deletion src/assets/field/dist/js/RedactorInput.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 134217a

Please sign in to comment.