0
angular-tinymce 지시문의 버그가 무엇인지 발견했습니다. 해결 방법이 있지만이 문제에 대해 더 좋은 해결책을 찾고 있습니다.모난 주석으로 인한 버그
기본적으로 동일한 구성을 사용하는 페이지에 두 개 이상의 텍스트 영역이 필요한 경우를 제외하고는 모든 것이 올바르게 작동합니다. 예를 들어 :
@Html.TextArea("BodyContent", null, new { @class = "form-control", ng_model = "bodyContent", ui_tinymce = "tinyMCEOptions" })
@Html.TextArea("Translate_BodyContent", null, new { @class = "form-control", ng_model = "translation.bodyContent", ui_tinymce = "tinyMCEOptions" })
와 설정은 다음과 같습니다 :
$scope.tinyMCEOptions = {
selector: "textarea#BodyContent,textarea#Translate_BodyContent",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
content_css: tinyMCEContentCss
};
그들은 모두 예상대로 TinyMCE에 편집자가 될 것이다,하지만, 서버로 데이터를 전송 저장할 때 문제는 두 번째 편집자입니다 값은 항상 비어 있습니다 ...
ui-tinymce
은 두 번째 텍스트 영역을 바인딩하는 것 같습니다. 내가 코드를 반복하는 데보다 더 우아한 해결책이있다 바라고 있어요 ..
@Html.TextArea("BodyContent", null, new { @class = "form-control", ng_model = "bodyContent", ui_tinymce = "tinyMCEOptions" })
@Html.TextArea("Translate_BodyContent", null, new { @class = "form-control", ng_model = "translation.bodyContent", ui_tinymce = "tinyMCEOptions2" })
$scope.tinyMCEOptions = {
selector: "textarea#BodyContent",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
content_css: tinyMCEContentCss
};
$scope.tinyMCEOptions2 = {
selector: "textarea#Translate_BodyContent",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
content_css: tinyMCEContentCss
};
오히려 끔찍한 그렇게 할 필요 : 내 해결 방법은 위의 복사본을 만들어 자신의 설정을 가지고 각각의 텍스트 영역을 설정하는 것이 었습니다.
편집
하는 데 도움이 경우 여기에 각 코드의 일부 :
var TranslationVM = function (item) {
this.id = '00000000-0000-0000-0000-000000000000';
this.pageId = '00000000-0000-0000-0000-000000000000';
this.cultureCode = '';
this.title = '';
this.isEnabled = false;
this.metaKeywords = '';
this.metaDescription = '';
this.bodyContent = '';
if (item) {
this.id = item.Id;
this.pageId = item.PageId;
this.cultureCode = item.CultureCode;
this.title = item.Title;
this.isEnabled = item.IsEnabled;
this.metaKeywords = item.MetaKeywords;
this.metaDescription = item.MetaDescription;
this.bodyContent = item.BodyContent;
}
};
pagesApp.controller('pageController', function ($scope, $http) {
$scope.emptyGuid = '00000000-0000-0000-0000-000000000000';
$scope.id = $scope.emptyGuid;
$scope.title = '';
$scope.slug = '';
$scope.metaKeywords = '';
$scope.metaDescription = '';
$scope.isEnabled = false;
$scope.bodyContent = '';
$scope.cssClass = '';
$scope.cultureCode = '';
$scope.translation = new TranslationVM();
//etc
확실하게 복사/붙여 넣기없이 개체를 반복하는 방법이 두 번 반복됩니다. 하나의 'ng-model'에는 객체 속성이 있고 다른 객체에는 기본 속성이 있습니다. 항상 ng 모델에 점이 있어야합니다. 또한 귀하의 문제와 관련이있을 수도 있습니다 – charlietfl
@charlietfl, 내 게시물에서 명확하지 않지만, 그 2 textareas는 관련이 없습니다; 등록 정보가 올바르게 지정됩니다. 각도 컨트롤러의 일부를 보려면 위의 내 업데이트를 참조하십시오. – Matt
최상의 제안은 문제를 복제하고 지시어에 대한 github repo에서 문제로 게시하는 데 있습니다. – charlietfl