kopia lustrzana https://gitlab.com/mysocialportal/relatica
18 wiersze
672 B
Dart
18 wiersze
672 B
Dart
import 'package:relatica/utils/html_to_edit_text_helper.dart';
|
|
import 'package:relatica/utils/string_utils.dart';
|
|
|
|
import '../../models/link_preview_data.dart';
|
|
|
|
extension LinkPreviewExtension on LinkPreviewData {
|
|
String toBodyAttachment() {
|
|
if (selectedImageUrl.isEmpty) {
|
|
return "[attachment type='link' url='$link' title='$title']$description[/attachment]";
|
|
}
|
|
|
|
final sanitizedTitle = toEditTextField(title).stripHyperlinks();
|
|
final sanitizedDescription = toEditTextField(description).stripHyperlinks();
|
|
|
|
return "[attachment type='link' url='$link' title='$sanitizedTitle' image='$selectedImageUrl']$sanitizedDescription[/attachment]";
|
|
}
|
|
}
|