blogifierdotnet / Blogifier

Blogifier is an open-source publishing platform Written in ASP.NET and Blazor WebAssembly. With Blogifier make a personal blog or a website.
https://blogifier.net
MIT License
1.29k stars 521 forks source link

GithubGist #93

Closed firatesmer closed 6 years ago

firatesmer commented 6 years ago

How to add GithubGist embed to post? I couldn't do it.

Nikkinoodl commented 6 years ago

I don't really know anything about GitHubGist, but it looks like it is typically embedded as a script in a blog post.

In the default setup for Blogifier, TinyMCE will strip out any embedded script tags.

To make it stop doing that you need to add the following attributes to the tinymce.init function in editorController.js:

    allow_script_urls: true,
    valid_elements: '[]',
    extended_valid_elements:'script[language|type|src]',

See this article for details.

If you're using the default Admin app editorController.js can be found here: /embedded/admin/standard/js/app/editorController.js

You can now insert a script in the TinyMCE code view window.

I've tested this out and was able to embed (and display!) the sample Gist below in my app without it being stripped out (I'm running version 1.4.5.0).

Sample Gist:

Cheers!

Edit: removed references to the TinyMCE 'fullpage' plugin which is unnecessary. I retested the solution without it and it works.

firatesmer commented 6 years ago

Thanks mate!

firatesmer commented 6 years ago

Actually, this code breaks something

allow_script_urls: true, valid_elements: '[]', extended_valid_elements:'script[language|type|src]',

But this one works fine

extended_valid_elements : "script[language|type|async|src|charset]",