mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 17:08:47 +08:00
Adds the ability to insert/edit snippets of html source code (#8668)
* adds a new tinyMCE plugin enabling editing a piece of html source code * - Adds the new plugin to the VS project - Adds js minified version
This commit is contained in:
parent
55ec9e2335
commit
6283106c53
@ -13,9 +13,9 @@ tinyMCE.init({
|
||||
theme: "modern",
|
||||
schema: "html5",
|
||||
plugins: [
|
||||
"advlist, anchor, autolink, autoresize, charmap, code, colorpicker, contextmenu, directionality, emoticons, fullscreen, hr, image, insertdatetime, link, lists, media, nonbreaking, pagebreak, paste, preview, print, searchreplace, table, template, textcolor, textpattern, visualblocks, visualchars, wordcount" + mediaPlugins
|
||||
"advlist, anchor, autolink, autoresize, charmap, code, colorpicker, contextmenu, directionality, emoticons, fullscreen, hr, image, insertdatetime, link, lists, media, nonbreaking, pagebreak, paste, preview, print, searchreplace, table, template, textcolor, textpattern, visualblocks, visualchars, wordcount, htmlsnippets" + mediaPlugins
|
||||
],
|
||||
toolbar: "undo redo cut copy paste | bold italic | bullist numlist outdent indent formatselect | alignleft aligncenter alignright alignjustify ltr rtl | " + mediaPlugins + " link unlink charmap | code fullscreen",
|
||||
toolbar: "undo redo cut copy paste | bold italic | bullist numlist outdent indent formatselect | alignleft aligncenter alignright alignjustify ltr rtl | " + mediaPlugins + " link unlink charmap | code htmlsnippetsbutton fullscreen",
|
||||
convert_urls: false,
|
||||
valid_elements: "*[*]",
|
||||
// Shouldn't be needed due to the valid_elements setting, but TinyMCE would strip script.src without it.
|
||||
|
@ -0,0 +1,42 @@
|
||||
|
||||
tinymce.PluginManager.add('htmlsnippets', function(editor, url) {
|
||||
var htmlSnippetAction = function() {
|
||||
// Open window
|
||||
var modalWindow = editor.windowManager.open({
|
||||
title: 'Insert/edit HTML snippets',
|
||||
body: [
|
||||
{type: 'textbox', value: editor.selection.getContent(), multiline: true, name: 'html_snippet', label: 'HTML Snippet', minHeight:350}
|
||||
],
|
||||
height: 400,
|
||||
width: 600,
|
||||
onsubmit: function(e) {
|
||||
// Insert content when the window form is submitted
|
||||
editor.insertContent(e.data.html_snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add a button that opens a window
|
||||
editor.addButton('htmlsnippetsbutton', {
|
||||
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QAEABHAPK/xSSIAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAvElEQVRIx+2VsRHCMAxFH3AwAR075CjSpGOfLEU6nAKmoIICJohHYANoVPjAji0nNLn8OxeSvny2vmTDDCUOQOfYb1mptpU9grDKDX12N20Nvq88OH+ZkLQGDFA7vho4SWwQdkADPIHS8ZfiOwonC1s5+R2oPPFKYka46hpegCtQ9PD3wA0452qwiXBWwlnklqhNKFGrKVFI5EdA5EYrsm8OQm1qPG0anaPRB216eI3wXNvYh2P/+eHM+MEHpr9Js1lOQvUAAAAASUVORK5CYII=',
|
||||
tooltip: 'Html snippet',
|
||||
onclick: htmlSnippetAction
|
||||
});
|
||||
|
||||
// Adds a menu item to the tools menu
|
||||
editor.addMenuItem('HTMLsnippetmenuitem ', {
|
||||
text: 'Html snippet',
|
||||
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QAEABHAPK/xSSIAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAvElEQVRIx+2VsRHCMAxFH3AwAR075CjSpGOfLEU6nAKmoIICJohHYANoVPjAji0nNLn8OxeSvny2vmTDDCUOQOfYb1mptpU9grDKDX12N20Nvq88OH+ZkLQGDFA7vho4SWwQdkADPIHS8ZfiOwonC1s5+R2oPPFKYka46hpegCtQ9PD3wA0452qwiXBWwlnklqhNKFGrKVFI5EdA5EYrsm8OQm1qPG0anaPRB216eI3wXNvYh2P/+eHM+MEHpr9Js1lOQvUAAAAASUVORK5CYII=',
|
||||
context: 'insert',
|
||||
onclick: htmlSnippetAction
|
||||
});
|
||||
|
||||
return {
|
||||
getMetadata: function () {
|
||||
return {
|
||||
name: "Html snippets plugin"
|
||||
//url: "http://exampleplugindocsurl.com"
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
1
src/Orchard.Web/Modules/TinyMce/Scripts/plugins/htmlsnippets/plugin.min.js
vendored
Normal file
1
src/Orchard.Web/Modules/TinyMce/Scripts/plugins/htmlsnippets/plugin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("htmlsnippets",function(A,t){var n=function(){A.windowManager.open({title:"Insert/edit HTML snippets",body:[{type:"textbox",value:A.selection.getContent(),multiline:!0,name:"html_snippet",label:"HTML Snippet",minHeight:350}],height:400,width:600,onsubmit:function(t){A.insertContent(t.data.html_snippet)}})};return A.addButton("htmlsnippetsbutton",{image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QAEABHAPK/xSSIAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAvElEQVRIx+2VsRHCMAxFH3AwAR075CjSpGOfLEU6nAKmoIICJohHYANoVPjAji0nNLn8OxeSvny2vmTDDCUOQOfYb1mptpU9grDKDX12N20Nvq88OH+ZkLQGDFA7vho4SWwQdkADPIHS8ZfiOwonC1s5+R2oPPFKYka46hpegCtQ9PD3wA0452qwiXBWwlnklqhNKFGrKVFI5EdA5EYrsm8OQm1qPG0anaPRB216eI3wXNvYh2P/+eHM+MEHpr9Js1lOQvUAAAAASUVORK5CYII=",tooltip:"Html snippet",onclick:n}),A.addMenuItem("HTMLsnippetmenuitem ",{text:"Html snippet",image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QAEABHAPK/xSSIAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAvElEQVRIx+2VsRHCMAxFH3AwAR075CjSpGOfLEU6nAKmoIICJohHYANoVPjAji0nNLn8OxeSvny2vmTDDCUOQOfYb1mptpU9grDKDX12N20Nvq88OH+ZkLQGDFA7vho4SWwQdkADPIHS8ZfiOwonC1s5+R2oPPFKYka46hpegCtQ9PD3wA0452qwiXBWwlnklqhNKFGrKVFI5EdA5EYrsm8OQm1qPG0anaPRB216eI3wXNvYh2P/+eHM+MEHpr9Js1lOQvUAAAAASUVORK5CYII=",context:"insert",onclick:n}),{getMetadata:function(){return{name:"Html snippets plugin"}}}});
|
@ -220,6 +220,8 @@
|
||||
<Content Include="Scripts\plugins\help\plugin.min.js" />
|
||||
<Content Include="Scripts\plugins\hr\plugin.js" />
|
||||
<Content Include="Scripts\plugins\hr\plugin.min.js" />
|
||||
<Content Include="Scripts\plugins\htmlsnippets\plugin.js" />
|
||||
<Content Include="Scripts\plugins\htmlsnippets\plugin.min.js" />
|
||||
<Content Include="Scripts\plugins\imagetools\plugin.js" />
|
||||
<Content Include="Scripts\plugins\imagetools\plugin.min.js" />
|
||||
<Content Include="Scripts\plugins\image\plugin.js" />
|
||||
@ -428,4 +430,4 @@
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user