当前位置: 首页 > 工具软件 > GrapesJS > 使用案例 >

html调用so,javascript - 将远程html文件加载到grapesjs中 - SO中文参考 - www.soinside.com...

戚奇略
2023-12-01

能够使用加载URL来获取我的远程HTML文件并获得良好的状态,如何将该获取的HTML和CSS加载到编辑器中?当前我在编辑器中出现黑屏。

到目前为止我尝试过的:storageManager: {

type: 'remote',

autosave: false,

autoload: true,

contentTypeJson: false,

setStepsBeforeSave: 1,

contentTypeJson: true,

params: {

},

storeComponents: true,

storeStyles: true,

storeHtml: true,

storeCss: true,

urlStore: '../inc/page/edit_builder.php?id=<?php echo $pid; ?>',

urlLoad: '../inc/page/fetch_builder.php?id=<?php echo $pid; ?>',

headers: {

'Content-Type': 'application/json'

},

json_encode:{

"gjs-html": [],

"gjs-css": [],

}

//headers: { Authorization: 'Basic ...' },

}

editor.load(res => console.log('Load callback'));

从服务器$id = $_GET['id'];

$result = mysqli_query($mysqli, "SELECT * FROM mp_pages WHERE page_id='$id'");

$response= array();

while($row = mysqli_fetch_array($result))

{

array_push($response, array(

"gjs-html"=>$row['page_desc'],

"gjs-css"=>$row['css']

));

}

echo json_encode($response);

mysqli_close($mysqli);

 类似资料: