@@ -51,16 +51,14 @@ This means that you need to inject the icons stylesheet into the `<iframe>`, so
51
51
@inject IJSRuntime js
52
52
53
53
<TelerikEditor @bind-Value="@EditorValue"
54
- Tools="@EditorTools "
54
+ Tools="@EditorToolSets.All "
55
55
Schema="schemaProvider"
56
56
Height="300px">
57
57
</TelerikEditor>
58
58
59
59
@code {
60
60
private string EditorValue { get; set; } = @"<p>Here is an example icon in the Editor content <i class='fa fa-info-circle'></i></p>";
61
61
62
- private List<IEditorTool> EditorTools { get; set; } = new List<IEditorTool>() { new ViewHtml() };
63
-
64
62
protected override async Task OnAfterRenderAsync(bool firstRender)
65
63
{
66
64
if (firstRender)
@@ -103,9 +101,13 @@ This means that you need to inject the icons stylesheet into the `<iframe>`, so
103
101
const schema = args.getSchema();
104
102
const Schema = args.ProseMirror.Schema
105
103
104
+ // remove the default i mark that does not support the class attribute
105
+ let marks = schema.spec.marks.remove("i");
106
+
107
+ // add the modified i as a node
106
108
let nodes = schema.spec.nodes.addToEnd("i", iconNode);
107
109
108
- const newSchema = new Schema({ nodes });
110
+ const newSchema = new Schema({ nodes, marks });
109
111
return newSchema;
110
112
}
111
113
@@ -155,7 +157,7 @@ Make sure to use the correct way and resources for your actual project *@
155
157
@code {
156
158
private string EditorValue { get; set; } = @"Here is an example icon in the Editor content <i class='fa fa-info-circle'></i>";
157
159
158
- private List<IEditorTool> EditorTools { get; set; } = new List<IEditorTool>() { new ViewHtml() } ;
160
+ private List<IEditorTool> EditorTools { get; set; } = EditorToolSets.All ;
159
161
}
160
162
161
163
@* Move JavaScript code to a separate JS file in production *@
@@ -185,16 +187,19 @@ Make sure to use the correct way and resources for your actual project *@
185
187
return ["i", attrs];
186
188
},
187
189
};
188
- debugger
189
190
190
191
//add the icon node to the Editor ProseMirror schema
191
192
window.schemaProvider = (args) => {
192
193
const schema = args.getSchema();
193
194
const Schema = args.ProseMirror.Schema
194
195
196
+ // remove the default i mark that does not support the class attribute
197
+ let marks = schema.spec.marks.remove("i");
198
+
199
+ // add the modified i as a node
195
200
let nodes = schema.spec.nodes.addToEnd("i", iconNode);
196
201
197
- const newSchema = new Schema({ nodes });
202
+ const newSchema = new Schema({ nodes, marks });
198
203
return newSchema;
199
204
}
200
205
@@ -204,4 +209,4 @@ Make sure to use the correct way and resources for your actual project *@
204
209
## See Also
205
210
206
211
* [ Custom Editor Tools] ({%slug editor-custom-tools%})
207
- * [ Modify the ProseMirror Schema] ({%slug editor-modify-default-schema%})
212
+ * [ Modify the ProseMirror Schema] ({%slug editor-modify-default-schema%})
0 commit comments