2017-08-10 100 views
-1

我有一個關於從Kendo Editor中刪除所有可能性標記的查詢。我嘗試過/ < [^>] *> /和其他reg表達式,但無法使其正常工作。使用kendoEditor從MVC中的HTML TextArea中刪除所有標記

這裏我附上了我的編輯器。

Remove HTML tags 任何人都可以告訴我如何從檢索到的數據中刪除所有這些標籤和樣式屬性,並只獲取純文本。

回答

0

要顯示出樣式標籤的內容,您必須在您的html文件中添加.Encode(False)

如:

 <div> 
     @(Html.Kendo().Editor().Encode(false) 
          .Name("Description") 

          .HtmlAttributes(new { style = "width:200%;height:400px;", @id = "Ceditor" }) 
          .Tools(tools => tools 
           .Clear() 
           .Bold().Italic().Underline().Strikethrough() 
           .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull() 
           .InsertUnorderedList().InsertOrderedList() 
           .Outdent().Indent() 
           .CreateLink().Unlink() 
           .InsertImage() 
           .InsertFile() 
           .SubScript() 
           .SuperScript() 
           .TableEditing() 
           .ViewHtml() 
           .Formatting() 
           .CleanFormatting() 
           .FontName() 
           .FontSize() 
           .FontColor().BackColor() 
           .Print() 
         ) 
          .Value(@<text> 
         </text>) 
        ) 
       </div> 
相關問題