Improve classic editor support
This commit is contained in:
parent
3ea79e669c
commit
1e0ddad379
|
@ -44,7 +44,8 @@ if ( !class_exists( 'CognitoFormsPlugin' ) ) {
|
|||
private static $actions = array(
|
||||
'admin_init',
|
||||
'admin_menu',
|
||||
'init'
|
||||
'init',
|
||||
'wp_ajax_cognito_tinymce_dialog'
|
||||
);
|
||||
|
||||
// Supported shortcodes
|
||||
|
@ -182,6 +183,11 @@ if ( !class_exists( 'CognitoFormsPlugin' ) ) {
|
|||
return $plugin_array;
|
||||
}
|
||||
|
||||
public function wp_ajax_cognito_tinymce_dialog() {
|
||||
include 'tinymce/dialog.php';
|
||||
wp_die();
|
||||
}
|
||||
|
||||
// Initialize administration menu (left sidebar)
|
||||
public function admin_menu() {
|
||||
add_menu_page( 'Cognito Forms', 'Cognito Forms', 'manage_options', 'Cognito', array( $this, 'main_page' ), "data:image/svg+xml;base64," . base64_encode( file_get_contents( plugin_dir_path( __FILE__ ) . 'cogicon.svg' ) ) );
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
?>
|
||||
|
||||
<?php require_once dirname( __FILE__ ) . '/../api.php'; ?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -29,6 +31,7 @@
|
|||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
line-height: 0;
|
||||
}
|
||||
#cognito-frame {
|
||||
width: 100%;
|
||||
|
@ -38,7 +41,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="cognito-frame" src="https://forms.cognito.test/integrations/cms"></iframe>
|
||||
<iframe id="cognito-frame" src="<?= CognitoAPI::$formsBase ?>/integrations/cms"></iframe>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('message', handleMessage);
|
||||
|
@ -48,7 +51,6 @@
|
|||
var baseUrl = new URL(frame.getAttribute('src')).origin;
|
||||
|
||||
if (event.origin === baseUrl) {
|
||||
console.log('Message received!');
|
||||
sendData(event.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
editor.addCommand( 'cognito_embed_window', function() {
|
||||
editor.windowManager.open( {
|
||||
title: 'Cognito Forms',
|
||||
url: url + '/dialog.php',
|
||||
url: ajaxurl + '?action=cognito_tinymce_dialog',
|
||||
width: 500,
|
||||
height: 500,
|
||||
} );
|
||||
|
|
Loading…
Reference in New Issue