Erstens, ich bin mir nicht sicher, ob dies auch in Ordnung ist ausgeschaltet Antwort der SG 86 auf huckepack, also nicht züchtigt mich nicht, wenn es nicht ...
Ich habe das Beispiel von SG 86 verwendet und festgestellt, dass Sie die von TinyMCE bereitgestellten Rechtschreibprüfungsfunktionen nicht direkt verwenden können, aber wenn Sie den von einem Forumbenutzer bereitgestellten Hack verwenden, funktioniert er erfolgreich.
- installieren und einrichten TinyMCE
- Folgen Sie den Anweisungen von Forum Benutzer
Alle Kredit für diese Lösung mit TinyMCE zum ursprünglichen Forum user @http://tinymce.com/forum/viewtopic.php?id=15662
Ich empfehle gehen googiespell einrichten, um mit einem einfachen textarea mit asp zuerst zu arbeiten: googiespell ist hier: http://orangoo.com/labs/GoogieSpell/
das ASP-Skript ist ASP-Proxy James Newtons auf dieser Seite: http://orangoo.com/labs/GoogieSpell/Documentation/ Also, wenn Sie bekam das hier funktioniert, wie Sie dies mit TinyMCE integrieren in Ihrem Javascript-Setup die Rechtschreibprüfung config:
<script language="javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "spellchecker",
theme_advanced_buttons3_add : "spellchecker",
spellchecker_rpc_url : "/googiespell/spell.asp",
spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
});
</script>
Bearbeiten Sie die Zeile :
spellchecker_rpc_url : "/googiespell/spell.asp",
, wo Ihre spell.asp Datei auf Ihrer Anwendung befindet sich auf Punkt
Ersetzen Sie den Inhalt der spell.asp mit dem folgenden Code:
<%
Dim ByteCount, BinRead
ByteCount = Request.TotalBytes
BinRead = Request.BinaryRead(ByteCount)
rawData = RSBinaryToString(BinRead)
'get language
if instr(rawData, """params"":[""") > 1 then
lang = mid(rawData, InStr(rawData,"[")+2, 2)
else
lang = "en"
end if
if instr(rawData, """method"":""checkWords"",") > 1 then
'return mispelled words
json = mid(rawData, InStrRev(rawData,"["))
json = mid(json, 1, instr(json, "]"))
json = replace(json, """,""", " ")
json = replace(json, """", "")
t = json
r = "<?xml version=""1.0"" encoding=""utf-8"" ?><spellrequest textalreadyclipped=""0"" ignoredups=""0"" ignoredigits=""1"" ignoreallcaps=""1""><text>"_
&t&"</text></spellrequest>"
r = getURL("https://www.google.com/tbproxy/spell?lang="&lang, r, "","")
out = "{""id"":null,""result"":["
wrds = ""
for each c in filter(split(r,"<c "),"</c>")
'response.write "<br>"&server.htmlencode(c)
o = cint(split(split(c,"o=",2)(1),"""")(1))+1
l = cint(split(split(c,"l=",2)(1),"""")(1))
s = cint(split(split(c,"s=",2)(1),"""")(1))
out = out & """" & mid(t,o,l)& """, "
wrds = "1"
next
if wrds = "" then
out = "{""id"":null,""result"":[],""error"":null}"
else
out = mid(out, 1, len(out)-2) & "],""error"":null}"
end if
response.write out
response.end
else
'return single word corrections
json = mid(rawData, InStrRev(rawData,"["))
json = mid(json, 1, instr(json, "]"))
json = replace(json, """,""", " ")
json = replace(json, "en ", "")
json = replace(json, """", "")
t = json
r = "<?xml version=""1.0"" encoding=""utf-8"" ?><spellrequest textalreadyclipped=""0"" ignoredups=""0"" ignoredigits=""1"" ignoreallcaps=""1""><text>"_
&t&"</text></spellrequest>"
r = getURL("https://www.google.com/tbproxy/spell?lang="&lang, r, "","")
for each c in filter(split(r,"<c "),"</c>")
'response.write "<br>"&server.htmlencode(c)
o = cint(split(split(c,"o=",2)(1),"""")(1))+1
l = cint(split(split(c,"l=",2)(1),"""")(1))
s = cint(split(split(c,"s=",2)(1),"""")(1))
c = textbetween(">", c, "<")
'{"id":null,"result":["Titmice","Times","Tines","Tinnies","Timmy\'s"],"error":null}
out = "{""id"":null,""result"":["
wrds = ""
for each w in split(c,vbTab)
out = out & """" & w & """, "
wrds = "1"
next
if wrds = "" then
out = "{""id"":null,""result"":[],""error"":null}"
else
out = mid(out, 1, len(out)-2) & "],""error"":null}"
end if
next
response.write out
response.end
end if
if t=empty then t = request.form() 'GoogieSpell is going to put the text in the POST data.
'show the reply from google for the POST data.
response.write getURL("https://www.google.com/tbproxy/spell?lang="&lang, t, "","")
Function TextBetween(sThis, sAnd, sThat)
on error resume next
TextBetween = split(split(sAnd,sThis,2,1)(1),sThat,2,1)(0)
end function
Function RSBinaryToString(xBinary)
Dim Binary
If vartype(xBinary)=8 Then Binary = MultiByteToBinary(xBinary) Else Binary = xBinary
Dim RS, LBinary
Const adLongVarChar = 201
Set RS = CreateObject("ADODB.Recordset")
LBinary = LenB(Binary)
If LBinary>0 Then
RS.Fields.Append "mBinary", adLongVarChar, LBinary
RS.Open
RS.AddNew
RS("mBinary").AppendChunk Binary
RS.Update
RSBinaryToString = RS("mBinary")
Else
RSBinaryToString = ""
End If
End Function
function getURL(aURL, anyPostData, anyUserName, anyPassword)
DIM objSrvHTTP,web,method,s
on error resume next
s=""
set objSrvHTTP = Server.CreateObject ("Msxml2.ServerXMLHTTP.3.0")
if anyPostData=empty then
objSrvHTTP.open "GET",aURL, true, anyUsername, anyPassword
else
objSrvHTTP.open "POST",aURL, true, anyUsername, anyPassword
objSrvHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
end if
objSrvHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"
objSrvHTTP.send anyPostData
objSrvHTTP.waitForResponse 7
select case objSrvHTTP.readyState
case 0 'object created, but no URL opened
debug "getURL("&aURL&", "&anyPostData&", "&anyUserName&", "&anyPassword&"): Object Created, no URL opened"
err.raise 1, "Object Created, no URL opened"
exit function
case 1 'loading: URL opened, but no data sent
debug "getURL("&aURL&", "&anyPostData&", "&anyUserName&", "&anyPassword&"):URL opened, no data sent"
err.raise 2, "URL opened, no data sent"
exit function
case 2 'loaded: data sent, status and headers available, no response recieved.
debug "getURL("&aURL&", "&anyPostData&", "&anyUserName&", "&anyPassword&"):No response from remote host"
err.raise 3, "No response from remote host"
exit function
case 3 'interactive: some data recieved. responseBody and responseText will return partial results.
debug "getURL("&aURL&", "&anyPostData&", "&anyUserName&", "&anyPassword&"):Partial response recieved:"
debug server.htmlencode(objSrvHTTP.responseText)
s = objSrvHTTP.responseText
err.raise 4, "Partial response recieved"
case 4 'complete:
s = objSrvHTTP.responseText
end select
getURL = s
end function
%>
Bearbeiten - mein Header für Klarheit hinzugefügt:
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js" ></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "spellchecker",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,undo,redo,|,copy,paste,|,spellchecker",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
spellchecker_rpc_url : "googiespell/spell.asp", <--! Needs to point to where the spell.asp script is located on your server. -->
spellchecker_languages : "+English=en,Spanish=es"
});
</script>
Haben Sie dies funktioniert? – RogueSpear00
@ RogueSpear00 Entschuldigung, ich dachte, du würdest die Notizen unten sehen. Ich habe es teilweise funktioniert, aber nachdem ich das Update auf James Newtons ASP-Proxy mache, funktioniert es nicht richtig. Siehe meine Kommentare unten. Danke für das Nachschlagen! Ich hoffe, dass dies bald behoben – Cineno28