feincms MediaFileをRichTextContentフォーム要素(ckeditorまたはtinyMCE)に挿入する標準的なソリューションはありますか?私はドキュメント内で何かを見つけることができませんでした...今ユーザは、medialibにURLを貼り付けて、ページに移動して貼り付ける必要があります。Feincms MediaFile in RichTextContent
6
A
答えて
2
あなたは、このための独自の実装を作成する必要があります。 dismissRelatedLookupPopupを上書きするのはちょっとハッキリですが、Djangoはより良い解決策をサポートしていないようです。
更新:このticketは、ポップアップの問題を説明しています。
'ckeditor'が存在する静的フォルダに、プラグインを作成します。
/app/
/static/
/app/
/js/
/ckeditor/
/plugins/
/feincms/
/images/
mediaFile.png
plugin.js
plugin.js
/**
* Basic sample plugin inserting a feincms mediaFile into the CKEditor editing area.
*/
// Register the plugin with the editor.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.plugins.html
CKEDITOR.plugins.add('feincms',
{
// The plugin initialization logic goes inside this method.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.pluginDefinition.html#init
init: function(editor)
{
// Define an editor command that inserts a feincms.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#addCommand
editor.addCommand('insertMediaFile',
{
// Define a function that will be fired when the command is executed.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.commandDefinition.html#exec
exec : function(editor)
{
// Define your callback function
function insertMediaFile(imageUrl) {
// Insert the imageUrl into the document. Style represents some standard props.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertHtml
editor.insertHtml('<img src="/media/' + imageUrl + '" style="float:left;margin-right:10px;margin-bottom:10px;width:200px;" />');
}
var imageUrl;
window.dismissRelatedLookupPopup = function (win, chosenId) {
imageUrl = $(win.document.body).find('#_refkey_' + chosenId).val();
insertMediaFile(imageUrl);
var name = windowname_to_id(win.name);
var elem = document.getElementById(name);
if (elem) {
if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
elem.value += ',' + chosenId;
} else {
document.getElementById(name).value = chosenId;
}
}
win.close();
};
var win = window.open('/admin/medialibrary/mediafile/?pop=1', 'id_image', 'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus();
}
});
// Create a toolbar button that executes the plugin command.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ui.html#addButton
editor.ui.addButton('feincms',
{
// Toolbar button tooltip.
label: 'Insert MediaFile',
// Reference to the plugin command name.
command: 'insertMediaFile',
// Button's icon file path.
icon: this.path + 'images/mediaFile.png'
});
}
});
は、例えば、CKEditorバージョンのinitスクリプトにプラグインを追加してください
0
私は知りません。あなたは常に(時には)はRichTextContentに関連したMediaFileが必要な場合は、独自のコンテンツタイプを記述します。
from feincms.module.medialibrary.fields import MediaFileForeignKey
from feincms.content.richtext.models import RichTextContent
class RichTextAndMFContent(RichTextContent):
mf = MediaFileForeignKey(MediaFile)
class Meta:
abstract = True
def render(self, **kwargs):
...
+0
ありがとうございますが、それは本当に質問への回答ではありません – user2298943
関連する問題
- 1. Feincmsはコンテンツタイプを混合します
- 2. ページ管理のFeinCMSコンテンツタイプのフィールドの並べ替え
- 3. AudioStreaming a mediafile from web
- 4. uploadcareファイルからngCordova MediaFile
- 5. VPAIDランダムVASTを読み込むjavascript mediafile
- 6. MediaPlugin - PathからMediaFileを取得する
- 7. UWP - MediaFileをStorageFileに変換する
- 8. 誰でもFeinCMSやメザニンの経験がありますか?
- 9. Xamarin Forms Mediaプラグイン、MediaFileからストリームまたはStorageFileを取得
- 10. 地域内のFeinCMSコンテンツタイプを移動するオプションを無効にする
- 11. SQL:NOT IN INクエリ
- 12. in in Railsの
- 13. %in%in R
- 14. LINQはIN INクエリー
- 15. struct in struct in struct
- 16. SELECT ... WHERE IN IN JOIN
- 17. FoldRight in Laziness in scala
- 18. BST in java in arrays
- 19. AS3 - for(... in ...)対(... in ...)
- 20. cmpfunc in bsearch()in c
- 21. floating.pie in plotrix in R
- 22. ACF in group in R
- 23. OSError in os.wait in python
- 24. "in" in insert after insert
- 25. viewmodelでmediaFileにアクセスしてコンテンツページで使用するにはどうすればよいですか?
- 26. eloquent id in in many to many
- 27. checkboxGroupInput in R giny in ggplot
- 28. * before iterable in print()in Python
- 29. order of()in return type()in R
- 30. FP LCM in scala in 1 line
これは私が思いついたことです... – user2298943