CKEDITOR.dialog.add('leaflet', function(editor) { var autocomplete; var mapContainer = ''; // Access the current translation file. var pluginTranslation = editor.lang.leaflet; // Use the core translation file. Used mainly for the `Alignment` values. var commonTranslation = editor.lang.common; // Dialog's function callback for the Leaflet Map Widget. return { title: pluginTranslation.dialogTitle, minWidth: 320, minHeight: 125, contents: [{ // Create a Location tab. id: 'location_tab', label: pluginTranslation.locationTabLabel, elements: [ // { // id: 'map_geocode', // className: 'geocode', // type: 'text', // label: pluginTranslation.googleSearchFieldLabel, // style: 'margin-top: -7px;', // // setup: function(widget) { // this.setValue(''); // }, // // onLoad: function (widget) { // // Get the DOM reference for the Search field. // var input = this.getInputElement().$; // // // Set a diffused/default text for better user experience. // // This will override the Google's default placeholder text: // // 'Enter a location'. // jQuery('.geocode input').attr('placeholder', pluginTranslation.googleSearchFieldHint); // // var config = editor.config; // // // Default value, but eventually will reach its quota if many users // // will just utilize this key instead of creating their own. // var googleApiKey = 'AIzaSyA9ySM6msnGm0qQB1L1cLTMBdKEUKPySmQ'; // // if (typeof config.leaflet_maps_google_api_key != 'undefined' && config.leaflet_maps_google_api_key != '') { // googleApiKey = config.leaflet_maps_google_api_key; // } // // // Execute only once, and not every dialog pop-up. // if (typeof google == 'undefined') { // // Load other needed external library. // // Wait for the script to finish loading before binding // // the autocomplete mechanism to prevent rendering issue. // CKEDITOR.scriptLoader.load('//maps.googleapis.com/maps/api/js?libraries=places&callback=dummy&key=' + googleApiKey, function() { // // Bind the Search field to the Autocomplete widget. // autocomplete = new google.maps.places.Autocomplete(input); // }); // } else { // autocomplete = new google.maps.places.Autocomplete(input); // } // // // Fix for the Google's type-ahead search displaying behind // // the widgets dialog window. // // Basically, we want to override the z-index of the // // Seach Autocomplete list, in which the styling is being set // // in real-time by Google. // // Make a new DOM element. // var stylesheet = jQuery('