-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4020 from GeotrekCE/feat_add_tools_for_flatpages_…
- Loading branch information
Showing
27 changed files
with
310 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
geotrek/flatpages/static/flatpages/tinymce/css/flatpage_custom_formats.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
h1, h2, h3 { | ||
clear: both; | ||
} | ||
|
||
.align-left { | ||
float: left; | ||
margin-right: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.align-right { | ||
float: right; | ||
margin-left: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.button-link { | ||
display: inline-block; | ||
padding: 0.5rem 1rem; | ||
border-radius: 1rem; | ||
border: 1px solid; | ||
text-decoration: none; | ||
} | ||
|
||
.information { | ||
clear: both; | ||
padding: 1rem; | ||
background: lightgray; | ||
} | ||
|
||
.suggestions { | ||
clear: both; | ||
display: block !important; | ||
background: lightgreen; | ||
color: green; | ||
padding: 2rem; | ||
border-radius: 1rem; | ||
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); | ||
clear: both; | ||
} | ||
|
||
.suggestions::before { | ||
content: '' attr(data-type) ' suggestions : ' attr(data-label) ''; | ||
font-size: 1.2rem; | ||
display: block; | ||
margin-bottom: .3rem; | ||
} | ||
|
||
.suggestions::after { | ||
content: 'Identifiants : ' attr(data-ids) ''; | ||
} |
129 changes: 129 additions & 0 deletions
129
geotrek/flatpages/static/flatpages/tinymce/js/additional_tinymce_plugins.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
Note: We have included the plugin in the same JavaScript file as the TinyMCE | ||
instance for display purposes only. Tiny recommends not maintaining the plugin | ||
with the TinyMCE instance and using the `external_plugins` option. | ||
*/ | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
tinymce.PluginManager.add('button-link', function (editor, url) { | ||
var openDialogButtonLink = function () { | ||
return editor.windowManager.open({ | ||
title: 'Lien bouton', | ||
body: { | ||
type: 'panel', | ||
items: [ | ||
{ | ||
type: 'input', | ||
name: 'label', | ||
label: 'Intitulé', | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'link', | ||
label: 'Lien', | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'target', | ||
label: 'Ouvrir dans un nouvel onglet' | ||
} | ||
] | ||
}, | ||
buttons: [ | ||
{ | ||
type: 'cancel', | ||
text: 'Close' | ||
}, | ||
{ | ||
type: 'submit', | ||
text: 'Save', | ||
primary: true | ||
} | ||
], | ||
initialData: { | ||
label: tinymce.activeEditor.selection.getContent(), | ||
}, | ||
onSubmit: function (api) { | ||
var data = api.getData(); | ||
if (!data.link || !data.label) { | ||
return; | ||
} | ||
var target = data.target ? ' target="_blank" rel="noopener noreferrer" ' : ''; | ||
editor.insertContent('<a class="button-link"' + target + 'href="' + data.link + '">' + data.label + '</a>'); | ||
api.close(); | ||
} | ||
}); | ||
}; | ||
|
||
var openDialogSuggestion = function () { | ||
return editor.windowManager.open({ | ||
title: 'Suggestions', | ||
body: { | ||
type: 'panel', | ||
items: [ | ||
{ | ||
type: 'listbox', | ||
name: 'type', | ||
label: 'Type', | ||
items: [ | ||
{value: 'trek', text: 'Trek'}, | ||
{value: 'touristicContent', text: 'Touristic content'}, | ||
{value: 'touristicEvent', text: 'Touristic event'}, | ||
{value: 'outdoorSite', text: 'Outdoor site'}, | ||
] | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'label', | ||
label: "Intitulé de l'encart", | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'ids', | ||
label: "Liste d'ID (séparés par des virgules)", | ||
} | ||
] | ||
}, | ||
buttons: [ | ||
{ | ||
type: 'cancel', | ||
text: 'Close' | ||
}, | ||
{ | ||
type: 'submit', | ||
text: 'Save', | ||
primary: true | ||
} | ||
], | ||
initialData: { | ||
label: tinymce.activeEditor.selection.getContent(), | ||
}, | ||
onSubmit: function (api) { | ||
var data = api.getData(); | ||
if (!data.type || !data.ids) { | ||
return; | ||
} | ||
editor.insertContent('<div class="suggestions" data-label="' + data.label + '" data-type="' + data.type + '" data-ids="' + data.ids + '" style="display: none" contenteditable="false"></div>'); | ||
api.close(); | ||
} | ||
}); | ||
}; | ||
/* Add a button that opens a window */ | ||
editor.ui.registry.addButton('button-link', { | ||
text: 'Lien bouton', | ||
onAction: function () { | ||
/* Open window */ | ||
openDialogButtonLink(); | ||
} | ||
}); | ||
/* Add a button that opens a window */ | ||
editor.ui.registry.addButton('suggestions', { | ||
text: 'Suggestions', | ||
onAction: function () { | ||
/* Open window */ | ||
openDialogSuggestion(); | ||
} | ||
}); | ||
}) | ||
|
||
}); // end of document DOMContentLoaded event handler |
78 changes: 0 additions & 78 deletions
78
geotrek/flatpages/static/tiny_mce/plugins/youtube/README.md
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
geotrek/flatpages/static/tiny_mce/plugins/youtube/css/styles.css
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-11.5 KB
geotrek/flatpages/static/tiny_mce/plugins/youtube/img/Google-YouTube-128.png
Binary file not shown.
Binary file removed
BIN
-212 Bytes
geotrek/flatpages/static/tiny_mce/plugins/youtube/img/youtube.gif
Binary file not shown.
10 changes: 0 additions & 10 deletions
10
geotrek/flatpages/static/tiny_mce/plugins/youtube/js/main.js
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
geotrek/flatpages/static/tiny_mce/plugins/youtube/js/vendor/jquery.js
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
geotrek/flatpages/static/tiny_mce/plugins/youtube/langs/de.js
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
geotrek/flatpages/static/tiny_mce/plugins/youtube/langs/en.js
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
geotrek/flatpages/static/tiny_mce/plugins/youtube/langs/es.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.