2019-12-11 07:12:22 +02:00
|
|
|
use super::*;
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
#[derive(Debug)]
|
2020-01-24 12:44:43 +02:00
|
|
|
pub struct Comment(docx_rs::Comment);
|
2019-12-11 07:12:22 +02:00
|
|
|
|
|
|
|
#[wasm_bindgen(js_name = createComment)]
|
2019-12-13 17:47:47 +02:00
|
|
|
pub fn create_comment(id: usize) -> Comment {
|
2020-01-24 12:44:43 +02:00
|
|
|
Comment(docx_rs::Comment::new(id))
|
2019-12-11 07:12:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Comment {
|
2020-01-24 12:44:43 +02:00
|
|
|
pub fn take(self) -> docx_rs::Comment {
|
2019-12-11 07:12:22 +02:00
|
|
|
self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
impl Comment {
|
|
|
|
pub fn author(mut self, author: String) -> Comment {
|
2020-01-24 10:57:14 +02:00
|
|
|
self.0.author = author;
|
2019-12-11 07:12:22 +02:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn date(mut self, date: String) -> Comment {
|
2020-01-24 10:57:14 +02:00
|
|
|
self.0.date = date;
|
2019-12-11 07:12:22 +02:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-12-21 10:30:42 +02:00
|
|
|
pub fn add_paragraph(mut self, p: Paragraph) -> Comment {
|
|
|
|
self.0 = self.0.add_paragraph(p.take());
|
2019-12-11 07:12:22 +02:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-08-13 19:57:59 +03:00
|
|
|
pub fn parent_comment_id(mut self, id: usize) -> Comment {
|
|
|
|
self.0 = self.0.parent_comment_id(id);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2019-12-13 17:47:47 +02:00
|
|
|
pub fn id(&self) -> usize {
|
|
|
|
self.0.id
|
2019-12-11 07:12:22 +02:00
|
|
|
}
|
|
|
|
}
|