есть ли Способ разделить все Ненужное Форматирование MS Word от FCKEditor

wixui расширение больше не wixui.wixlib. Это включилось в WixUIExtension.

, Если Вы находитесь на командной строке, добавьте -ext WixUIExtension к вызову к light.exe.

, Если у Вас есть проект WiX в Visual Studio, добавьте ссылку на "WixUIExtension" путем щелчка правой кнопкой по "References" в Проводник Решения .

Посмотрите страница WiXUI Dialog Sets для WIX3.

6
задан user161433 28 August 2009 в 23:15
поделиться

3 ответа

Here's a solution I use to scrub incoming HTML from rich text editors... it's written in VB.NET and I don't have time to convert to C#, but it's pretty straightforward:

 Public Shared Function CleanHtml(ByVal html As String) As String
     '' Cleans all manner of evils from the rich text editors in IE, Firefox, Word, and Excel
     '' Only returns acceptable HTML, and converts line breaks to <br />
     '' Acceptable HTML includes HTML-encoded entities.
     html = html.Replace("&" & "nbsp;", " ").Trim() ' concat here due to SO formatting
     '' Does this have HTML tags?
     If html.IndexOf("<") >= 0 Then
         '' Make all tags lowercase
         html = RegEx.Replace(html, "<[^>]+>", AddressOf LowerTag)
         '' Filter out anything except allowed tags
         '' Problem: this strips attributes, including href from a
         '' http://stackoverflow.com/questions/307013/how-do-i-filter-all-html-tags-except-a-certain-whitelist
         Dim AcceptableTags      As String   = "i|b|u|sup|sub|ol|ul|li|br|h2|h3|h4|h5|span|div|p|a|img|blockquote"
         Dim WhiteListPattern    As String   = "</?(?(?=" & AcceptableTags & ")notag|[a-zA-Z0-9]+)(?:\s[a-zA-Z0-9\-]+=?(?:([""']?).*?\1?)?)*\s*/?>"
         html = Regex.Replace(html, WhiteListPattern, "", RegExOptions.Compiled)
         '' Make all BR/br tags look the same, and trim them of whitespace before/after
         html = RegEx.Replace(html, "\s*<br[^>]*>\s*", "<br />", RegExOptions.Compiled)
     End If
     '' No CRs
     html = html.Replace(controlChars.CR, "")
     '' Convert remaining LFs to line breaks
     html = html.Replace(controlChars.LF, "<br />")
     '' Trim BRs at the end of any string, and spaces on either side
     Return RegEx.Replace(html, "(<br />)+$", "", RegExOptions.Compiled).Trim()
 End Function

 Public Shared Function LowerTag(m As Match) As String
   Return m.ToString().ToLower()
 End Function

In your case, you'll want to modify the list of "approved" HTML tags in "AcceptableTags"--the code will still strip all the useless attributes (and, unfortunately, the useful ones like HREF and SRC, hopefully those aren't important to you).

Of course, this requires a trip to the server. If you don't want that, you'll need to add some sort of "clean up" button to the toolbar that calls JavaScript to mess with the editor's current text. Unfortunately, "pasting" is not an event that can be trapped to clean up the markup automatically, and cleaning after every OnChange would make for an unusable editor (since changing the markup changes the text cursor position).

7
ответ дан 8 December 2019 в 05:22
поделиться

But fckeditor is, as the name and website suggests, a text editor. To me, that means it just shows you the characters in the file.

You can't have bold and italic formatting without some extra characters.

EDIT: Ah, I see. Looking more closely at the Fckeditor website, it's an HTML editor, not one of the simple text editors I'm used to.

There's Paste from Word cleanup with autodetection listed as a feature.

0
ответ дан 8 December 2019 в 05:22
поделиться

I understand the problem very well. When copying out of MS-Word (or any word processing or rich text editing aware text area) then pasting into FCKEditor (same problem happens with TinyMCE), the original markup is included in what is in the clipboard and gets processed. This markup is not always complimentary with the markup that it gets embedded in with the target of the paste operation.

I don't know the solution other than become a contributor to FCKEditor and study the code and make the modification. What I normally do is instruct users to perform a two phase clipboard operation.

  • Copy from MS-Word
  • Paste into notepad
  • Select all
  • Copy from notepad
  • Paste into FCKEDitor
2
ответ дан 8 December 2019 в 05:22
поделиться
Другие вопросы по тегам:

Похожие вопросы: