1
因此,我在WT项目中嵌入了一个Ace编辑器,并将Ace.js文件的副本加载到它中,作为测试以查看它的外观。负载很好,所以现在我试图保存它,并且我注意到我的保存功能没有被调用。经过一段时间的调试后,我注意到如果我试图保存的文件大于70000-80000个字符,并且被调用的很好,并且如果文件较小,则会传递数据。如何在尝试保存大文件时绕过此限制? ,我在WT项目运行的代码可以看到下面,就如何在这里Using ACE with WT如何保存WT编辑器中的所有文本?
WText *editor;
MyClass::MyClass(const WEnvironment& env)
: WApplication(env)
{
wApp->require("lib/src/ace.js");
// A WContainerWidget is rendered as a div
editor = new WText("function(){\n hello.abc();\n}\n", root());
editor->setInline(false);
editor->resize(500, 500);
std::string editor_ref = editor->jsRef(); // is a text string that will be the element when executed in JS
std::string command =
editor_ref + ".editor = ace.edit(" + editor_ref + ");" +
editor_ref + ".editor.setTheme(\"ace/theme/monokai\");" +
editor_ref + ".editor.getSession().setMode(\"ace/mode/javascript\");";
editor->doJavaScript(command);
JSignal <std::string> *jsignal = new JSignal<std::string>(editor, "textChanged");
jsignal->connect(this, &MyClass::textChanged);
WPushButton *b = new WPushButton("Save", root());
command = "function(object, event) {" +
jsignal->createCall(editor_ref + ".editor.getValue()") +
";}";
b->clicked().connect(command);
}
void MyClass::textChanged(std::string incoming)
{
}
它嵌入到现在,上面的代码,当按下保存按钮框TextChanged函数会被更多的细节。但是,如果加载大文件,我使用了下面的函数,并通过调用它来替换“function(){\ n hello.abc(); \ n} \ n”。
如前所述,我加载了Ace.js,它的长度约为15,000行。这导致我的保存呼叫失败。虽然我确信任何超过80,000个字符的文件都会导致它失败。先谢谢你!
我目前没有在我的项目中使用wt_config.xml,我会尝试添加它并设置最大请求大小。 – user2115945 2013-05-07 19:14:05