Skip to content

Commit c873418

Browse files
Jeremy ColemanJeremy Coleman
Jeremy Coleman
authored and
Jeremy Coleman
committed
Added HTML Editor option
1 parent 9df0941 commit c873418

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Built with SharePoint Framework GA, Office Fabric, and jQuery
1313

1414
## Screenshots
1515
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/True-Script-Editor/master/assets/full.png)
16-
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/True-Script-Editor/master/assets/ss1.png)
17-
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/True-Script-Editor/master/assets/settings.png)
16+
![](https://raw.githubusercontent.com/jcoleman-pcprofessional/True-Script-Editor/master/assets/True-Script-Editor.png)
1817

1918
## Applies to
2019

@@ -31,7 +30,7 @@ true-script-editor|Jeremy Coleman (PC Professional, Inc.)
3130

3231
Version|Date|Comments
3332
-------|----|--------
34-
33+
1.0.1|March 7th, 2017|Added HTML Editor option
3534
1.0.0|March 7th, 2017|Initial release
3635

3736
## Disclaimer
@@ -57,5 +56,6 @@ Sample Web Parts in this solution illustrate the following concepts on top of th
5756
- Load (multiple, csv delimited) external JS files onto the page
5857
- Execute script blocks on the page
5958
- Added CSS style directly to the page
59+
- Add HTML to render within the web part DOM element
6060

6161
![](https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/js-true-script-editor)

assets/True-Script-Editor.png

191 KB
Loading

config/package-solution.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"solution": {
33
"name": "True Script Editor",
44
"id": "ee1c0134-8052-4280-8448-287dd071fd0c",
5-
"version": "1.0.0.0"
5+
"version": "1.0.0.1"
66
},
77
"paths": {
88
"zippedPackage": "solution/true-script-editor.sppkg"

src/webparts/trueScriptEditor/ITrueScriptEditorWebPartProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export interface ITrueScriptEditorWebPartProps {
44
extJS:string;
55
scriptEditor:string;
66
cssEditor:string;
7+
htmlEditor: string;
78
}

src/webparts/trueScriptEditor/TrueScriptEditorWebPart.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default class TrueScriptEditorWebPart extends BaseClientSideWebPart<ITrue
1919
var loaded = [];
2020
jQuery('head').append('<style truescript></style>');
2121
jQuery('link[truescript]').each(function(){ jQuery(this).remove(); });
22-
23-
if (this.properties.cssEditor || this.properties.extCSS || this.properties.extJS || this.properties.scriptEditor) {
22+
jQuery(this.domElement).empty();
23+
if (this.properties.cssEditor || this.properties.extCSS || this.properties.extJS || this.properties.scriptEditor || this.properties.htmlEditor) {
2424
if (this.properties.scriptEditor){
2525
window['jQuery'] = jQuery;
2626
eval(this.properties.scriptEditor);
@@ -44,6 +44,9 @@ export default class TrueScriptEditorWebPart extends BaseClientSideWebPart<ITrue
4444
jQuery('head').append('<link truescript rel="stylesheet" href="' + css + '" type="text/css" />');
4545
});
4646
}
47+
if (this.properties.htmlEditor){
48+
jQuery(this.domElement).html(this.properties.htmlEditor);
49+
}
4750
} else {
4851
this.domElement.innerHTML = `
4952
<div class="${styles.helloWorld}">
@@ -105,6 +108,11 @@ export default class TrueScriptEditorWebPart extends BaseClientSideWebPart<ITrue
105108
label: 'CSS Editor',
106109
multiline: true,
107110
placeholder: 'CSS in this field will be added to the page, **Do not include <style> tags.'
111+
}),
112+
PropertyPaneTextField('htmlEditor',{
113+
label: 'HTML Editor',
114+
multiline: true,
115+
placeholder: 'HTML in this field will be added to the page, **Do not include <html>,<body> nor <footer> tags.'
108116
})
109117
]
110118
}

0 commit comments

Comments
 (0)