Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.0] Bugfix: Init PagePublicationFields on Pages Table #2533

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.1 (2023-07-07)

- Fix disconnecting Tinymce intersection observer [#2519](https://github.com/AlchemyCMS/alchemy_cms/pull/2519) ([tvdeyen](https://github.com/tvdeyen))

## 7.0.0 (2023-07-05)

- Remove old alchemy_admin files from sprockets builds [#2517](https://github.com/AlchemyCMS/alchemy_cms/pull/2517) ([tvdeyen](https://github.com/tvdeyen))
Expand Down
2 changes: 1 addition & 1 deletion alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "rspec-activemodel-mocks", ["~> 1.0"]
gem.add_development_dependency "rspec-rails", [">= 4.0.0.beta2"]
gem.add_development_dependency "simplecov", ["~> 0.20"]
gem.add_development_dependency "webdrivers", ["~> 5.0"]
gem.add_development_dependency "selenium-webdriver", ["~> 4.10"]
gem.add_development_dependency "webmock", ["~> 3.3"]
gem.add_development_dependency "shoulda-matchers", ["~> 5.0"]
gem.add_development_dependency "timecop", ["~> 0.9"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ $(document).on 'turbo:load', ->

$(document).on 'turbo:before-fetch-request', ->
# Ensure that all tinymce editors get removed before parsing a new page
Alchemy.Tinymce.removeIntersectionObserver()
Alchemy.Tinymce.removeFrom $('.has_tinymce')
return
12 changes: 8 additions & 4 deletions app/javascript/alchemy_admin/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ function initEditors(ids) {
// initialize IntersectionObserver
// the observer will initialize Tinymce if the textarea becomes visible
function initializeIntersectionObserver() {
if (tinymceIntersectionObserver !== null) {
tinymceIntersectionObserver.disconnect()
}

const observerCallback = (entries, observer) => {
entries.forEach((entry) => {
if (entry.intersectionRatio > 0) {
Expand Down Expand Up @@ -108,6 +104,12 @@ function removeEditor(editorId) {
}
}

function removeIntersectionObserver() {
if (tinymceIntersectionObserver !== null) {
tinymceIntersectionObserver.disconnect()
}
}

export default {
// Initializes all TinyMCE editors with given ids
//
Expand Down Expand Up @@ -135,6 +137,8 @@ export default {
})
},

removeIntersectionObserver,

// set tinymce configuration for a given selector key
setCustomConfig(key, configuration) {
tinymceCustomConfigs[key] = configuration
Expand Down
6 changes: 6 additions & 0 deletions app/views/alchemy/admin/pages/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@
<%= render partial: "table_row", collection: @pages, as: "page" %>
</tbody>
</table>

<script type="text/javascript">
$(function() {
Alchemy.PagePublicationFields();
});
</script>
2 changes: 1 addition & 1 deletion lib/alchemy/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Alchemy
VERSION = "7.0.0"
VERSION = "7.0.1"

def self.version
VERSION
Expand Down
1 change: 0 additions & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
require "rails-controller-testing"
require "rspec-activemodel-mocks"
require "rspec/rails"
require "webdrivers/chromedriver"
require "shoulda-matchers"
require "factory_bot"
require "view_component/test_helpers"
Expand Down