Comments (7)
Here's the fix for that error, which is in main.js:
/**
* Clone functionality from standard Image field type
*/
acf.fields.qtranslate_image = acf.Field.extend({
type: 'qtranslate_image',
focus: function() {
this.$el = this.$field.find('.acf-image-uploader.current-language');
this.$input = this.$el.find('input[type="hidden"]');
this.$img = this.$el.find('img');
this.o = acf.get_data(this.$el);
}
});
/**
* Clone functionality from standard File field type
*/
acf.fields.qtranslate_file = acf.Field.extend({
type: 'qtranslate_file',
focus: function() {
this.$el = this.$field.find('.acf-file-uploader.current-language');
this.$input = this.$el.find('input[type="hidden"]');
this.o = acf.get_data(this.$el);
}
});
/**
* Clone functionality from standard WYSIWYG field type
*/
acf.fields.qtranslate_wysiwyg = acf.Field.extend({
type: 'qtranslate_wysiwyg',
focus: function() {
this.$el = this.$field.find('.wp-editor-wrap.current-language').last();
this.$textarea = this.$el.find('textarea');
this.o = acf.get_data(this.$el);
this.o.id = this.$textarea.attr('id');
},
initialize: function() {
var self = this;
this.$field.find('.wp-editor-wrap').each(function() {
self.$el = jQuery(this);
self.$textarea = self.$el.find('textarea');
self.o = acf.get_data(self.$el);
self.o.id = self.$textarea.attr('id');
acf.fields.wysiwyg.initialize.call(self);
});
this.focus();
}
});
Essentially, you want to change the acf.field.image.extend (and every other .extend) to acf.Field.extend instead. Even with that fix though, there's still a tinymce error when switching from Text to Visual in the WYSIWYG editor.
from acf-qtranslate.
Same. Getting an error "cannot read property 'extend' of acf.field.image.extend -- prevents adding any images in acf-qtranslate image fields.
from acf-qtranslate.
Nthing this... Has the developer stopped providing updates?
from acf-qtranslate.
really appreciate this plugin! hope the developer can make it compatible with the 5.7.X.
from acf-qtranslate.
I did this and works fine:
/**
- Clone functionality from standard Image field type
*/
acf.registerFieldType(acf.models.ImageField.extend({
type: 'qtranslate_image',
$control: function(){
return this.$('.acf-image-uploader.current-language');
},
$input: function(){
return this.$('.acf-image-uploader.current-language input[type="hidden"]');
},
render: function( attachment ){
var control = this.$control();
// vars
attachment = this.validateAttachment( attachment );
// update image
control.find('img').attr({
src: attachment.url,
alt: attachment.alt,
title: attachment.title
});
// vars
var val = attachment.id || '';
// update val
this.val( val );
// update class
if( val ) {
control.addClass('has-value');
} else {
control.removeClass('has-value');
}
}
}));
/**
-
Clone functionality from standard File field type
*/
acf.registerFieldType(acf.models.QtranslateImageField.extend({
type: 'qtranslate_file',
render: function( attachment ){
var control = this.$control();// vars
attachment = this.validateAttachment( attachment );// update image
this.$control().find(' img').attr({
src: attachment.icon,
alt: attachment.alt,
title: attachment.title
});// update elements
control.find('[data-name="title"]').text( attachment.title );
control.find('[data-name="filename"]').text( attachment.filename ).attr( 'href', attachment.url );
control.find('[data-name="filesize"]').text( attachment.filesizeHumanReadable );// vars
var val = attachment.id || '';// update val
acf.val( this.$input(), val );// update class
if( val ) {
control.addClass('has-value');
} else {
control.removeClass('has-value');
}
},
}));
acf.registerFieldType(acf.models.WysiwygField.extend({
type: 'qtranslate_wysiwyg',
initializeEditor: function() {
var self = this;
this.$('.acf-editor-wrap').each(function() {
var
var $textarea = $wrap.find('textarea');
var args = {
tinymce: true,
quicktags: true,
toolbar: self.get('toolbar'),
mode: self.getMode(),
field: self
};
// generate new id
var oldId = $textarea.attr('id');
var newId = acf.uniqueId('acf-editor-');
// rename
acf.rename({
target: $wrap,
search: oldId,
replace: newId,
destructive: true
});
// update id
self.set('id', newId, true);
// initialize
acf.tinymce.initialize(newId, args);
});
}
}));
from acf-qtranslate.
hey @asedano thanks for this, I believe @funkjedi added this to the current version 1.7.24, right?
unfortunately it still doesn't work for me on any of my WYSIWYG fields.
[Error] TypeError: undefined is not an object (evaluating 'r[e]')
(anonymous function) (wp-tinymce.php:3:339907)
e (wp-tinymce.php:3:339965)
bind (wp-tinymce.php:3:11952)
init (wp-tinymce.php:3:341333)
e (editor.min.js:1:999)
(anonymous function) (editor.min.js:1:273)
C (wp-tinymce.php:3:11117)
d (wp-tinymce.php:3:11258)
downgrading to ACF 5.6.10 also didn't work I got a fatal php error:
Class 'acf_field' not found in /var/www/salomon/wp-content/plugins/ACF-Nav-Menu-Field/nav-menu-v5.php on Line 18
any hints with this?
from acf-qtranslate.
Thanks for updating
from acf-qtranslate.
Related Issues (20)
- ACF Custom menu link not working for two language.
- ACFPRO 5.7.0 Compatibility Issues HOT 2
- ACF 5.7.X compability HOT 2
- File field in v1.7.24 only shows images HOT 7
- Please add "(qtranslate)" info to field label HOT 3
- Hiding alternative content not working with ACF custom fields HOT 1
- jQuery 1.12.4 default WP vs 3.x
- Image field switches from "Image URL" to "Image array" after v4 to v5 upgrade
- How to search acf qtranslate fields? HOT 2
- acf-text-field maxlength check failing
- WP v5.1.1 tinymce error
- Media Library dont show thumbnails HOT 4
- Media Library Not Loading in Grid View HOT 7
- ACF WYSIWG editor removes paragraphs HOT 9
- The plugin does not work with Wordpress 5.3 HOT 7
- WP Media Library broken ACF Version 5.8.7 HOT 3
- jQuery conflict when using qTranslate Wysiwyg field
- Swith language without reload page
- acf-qtraslate for wordpress 5.8.1 versions.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acf-qtranslate.