我试图设计Google Maps InfoWindow的样式。对于我的每个地图标记,我都有一个在本地站点和JSFiddle中完美运行的窗口。但是,当我将代码添加到Drupal块时,它会删除结束div标签。
我试过这种方式:
`var message =
"<div class='window-container'>" +
"<div class='window-content'>" +
"<div class='window-header'>" +
"<div class='window-title'>" + name + "</div>" +
"<div class='window-subtitle'>" + org + "</div>" +
"</div>" +
"<div class='window-body'>" + summary + "...</div>" +
"</div>" +
"</div>";`
就这样:
`var message =
'<div class="window-container">\
<div class="window-content">\
<div class="window-header">\
<div class="window-title">' +name+ '</div>\
<div class="window-subtitle">' +org+ '</div>\
</div>\
<div class="window-body">' +summary+ '</div>\
</div>\
</div>';`
这种方式使用Babel编译器:
`var message = '
<div class="window-container">
<div class="window-content">
<div class="window-header">
<div class="window-title">${name}</div>
<div class="window-subtitle">${org}</div>
</div>
<div class="window-body">${summary}</div>
</div>
</div>'`
在页面上,在我的控制台中,它总是像这样出现!
`var message =
"<div class='window-container'>" +
"<div class='window-content'>" +
"<div class='window-header'>" +
"<div class='window-title'>" + name + "" +
"<div class='window-subtitle'>" + org + "" +
"" +
"<div class='window-body'>" + summary + "..." +
"" +
"";`
删除所有结束div标签!为什么呢?
答案 0 :(得分:0)
如果您将代码粘贴到ckeditor或其他过滤器中,那么您会遇到一些麻烦。
因此,它建议以编程方式创建自定义块,如下所述: https://drupal.stackexchange.com/questions/183499/how-to-create-a-new-block-programmatically