我在页面中使用 tinyMCE。我使用ajax捕获Ctrl+s保存内容,当焦点在tinyMCE之外时,一切正常,但是当焦点在tinyMCE中时,它不起作用。我需要一段代码插入到这个代码块中(而不是在设置或插件中)以使内容保存工作,即使焦点在 tinyMCE 内。
<script type="text/javascript">
$(document).ready(function() {
dssModify = new Sol.Dss.Modify();
dssModify.config =
{
urlActionContentSave: "<?php echo \Sol\Dss\Dss::me () -> urlActionContentSaveGet () ; ?>",
buttonContentSaveId: "<?php echo \Sol\Dss\Dss::me () -> modifyButtonContentSaveIdGet () ; ?>",
buttonContentSavingTitle: "<?php echo \Sol\Dss\Dss::me () -> modifyButtonContentSavingTitleGet () ; ?>",
buttonContentSaveTitle: "<?php echo \Sol\Dss\Dss::me () -> modifyButtonContentSaveTitleGet () ; ?>",
textareaContentId: "<?php echo \Sol\Dss\Dss::me () -> modifyTextareaContentIdGet () ; ?>",
formId: "<?php echo \Sol\Dss\Dss::me () -> modifyFormIdGet () ; ?>",
idRoutes: …
Run Code Online (Sandbox Code Playgroud) 我只是想知道这是否是在PHP中创建对象和实现工厂模式的正确方法.我知道我们有工厂方法模式和抽象工厂模式,但是我们有一个类似下面的模式 http://noondreams.com/shared/data/pages/images/Factory.png吗?
class Factory
{
public function make($format)
{
switch($format)
{
case Source::Assocs:
return new \Source\Formats\Assocs();
case Source::XML
return new \Source\Formats\XML();
//Some other formats
}
}
}
Run Code Online (Sandbox Code Playgroud)