class: FileApplicationNoteBook
authorClaus Gittinger <cg@exept.de>
Fri, 31 Oct 2014 12:19:22 +0100
changeset 14808 e36c7a43aee4
parent 14807 de0c45814622
child 14809 9025aeaf760f
class: FileApplicationNoteBook html-editor: added &-menu operation
FileApplicationNoteBook.st
--- a/FileApplicationNoteBook.st	Thu Oct 30 10:10:49 2014 +0100
+++ b/FileApplicationNoteBook.st	Fri Oct 31 12:19:22 2014 +0100
@@ -4719,6 +4719,9 @@
 #toggleCode
 'Toggle the selection''s code+pre attribute (if code, turn off; if not, turn on)'
 
+#toggleEscape
+'Escape the selected characters with &; escape sequences.\(i.e. change "<" into "&lt;")'
+
 #addAnchor
 'Make the selection an an anchor element'
 
@@ -5056,7 +5059,7 @@
             activeHelpKey: toggleItalic
             enabled: canEdit
             label: 'italic'
-            itemValue: editOperationToggleItalicHTML  
+            itemValue: editOperationToggleItalicHTML
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary #'edit_italic_15x15')
           )
@@ -5064,15 +5067,23 @@
             activeHelpKey: toggleCode
             enabled: canEdit
             label: 'code'
-            itemValue: editOperationToggleCodeHTML  
+            itemValue: editOperationToggleCodeHTML
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary #'edit_code_15x15')
           )
          (MenuItem
+            activeHelpKey: toggleEscape
+            enabled: canEdit
+            label: 'escape'
+            itemValue: editOperationEscapeSpecialCharactersHTML
+            isButton: true
+            labelImage: (ResourceRetriever ToolbarIconLibrary #'edit_escapeHTMLCharacters')
+          )
+         (MenuItem
             activeHelpKey: addAnchor
             enabled: canEdit
             label: 'anchor'
-            itemValue: editOperationAddAnchorHTML  
+            itemValue: editOperationAddAnchorHTML
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary #'edit_anchor15x15')
           )
@@ -5080,7 +5091,7 @@
             activeHelpKey: addImage
             enabled: canEdit
             label: 'image'
-            itemValue: editOperationAddImageHTML  
+            itemValue: editOperationAddImageHTML
             isButton: true
             labelImage: (ResourceRetriever ToolbarIconLibrary #'edit_image_15x15')
           )
@@ -5088,8 +5099,6 @@
         nil
         nil
       )
-
-    "Modified: / 02-08-2013 / 18:21:16 / cg"
 !
 
 menuEditorOperationsForNormalText
@@ -5461,6 +5470,20 @@
     "Created: / 02-08-2013 / 18:17:26 / cg"
 !
 
+editOperationEscapeSpecialCharactersHTML
+    |sel escaped|
+
+    sel := editView selectionAsString.
+    sel isNil ifTrue:[^ self].
+
+    escaped := HTMLUtilities withSpecialHTMLCharactersEscaped:sel.    
+    editView 
+        undoableDo:[
+            editView replaceSelectionBy:escaped keepCursor:false select:true
+        ]
+        info:'Escape HTML characters'
+!
+
 editOperationIndentCode
     editView indentBy4
 
@@ -7441,10 +7464,10 @@
 !FileApplicationNoteBook class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.303 2014-10-25 12:43:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.304 2014-10-31 11:19:22 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.303 2014-10-25 12:43:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.304 2014-10-31 11:19:22 cg Exp $'
 ! !