New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔦 Feature: Allow to set global default for interpreting LongText
columns as Markdown ("rich text")
#7832
Comments
@salim-b are you creating schema from the scratch? if so, it's a quite easily accessible option on the menu when creating a long text field. Are you connecting to existing DB and converting long text to rich text something? |
@dstala I'm connecting to an existing PostgreSQL DB with multiple tables. The columns I'd like NocoDB to interpret as Markdown are of type |
Discussed with the team - we do not have any plans as of now to make it as a configurable aspect; |
Ok, I understand. Thanks für the update.
How would that work exactly? Such a script would need to change NocoDB's internal metadata DB, right? |
You can refer to our API documentation at https://meta-apis-v2.nocodb.com/ let axios = require("axios").default;
let baseUrl = 'http://localhost:9000'
let authToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAbm9jb2RiLmNvbSIsImlkIjoidXNtM3IwbDI1OXh1cWpyZiIsInJvbGVzIjoib3JnLWxldmVsLWNyZWF0b3Isc3VwZXIiLCJ0b2tlbl92ZXJzaW9uIjoiZTU0OThjYWY3YzkzYjk2ZTc1MjhiZWNmODhkNTA2YzNiMjY1N2M0NjFjMTE1NzI0MzMzMTIzZjMzMzk0MmQ2NTI5NzU1ZWQ2MTIzMTdkNDMiLCJpYXQiOjE3MTA0MTEzMDAsImV4cCI6MTcxMDQ0NzMwMH0.akMkQm5Y3RzZYDfKcdy7X89Eygr5grRvcsBVC9EDoqY';
// table id can be retrieved from the URL when viewing the table in the browser
// example: http://localhost:9000/dashboard/#/nc/pekjheec4mwp7g5/mk61da5vmtj3qi3
let tableId = 'mk61da5vmtj3qi3'
async function nc_axios(options, token, data, cookie) {
if(token) {
options.headers = {'xc-auth': token}
}
if(data) {
options.data = data;
}
if(cookie) {
options.headers = {'xc-auth': token, 'withCredentials': true}
}
try {
let response = await axios.request(options);
return response.data;
} catch (error) {
console.error(error);
return error;
}
}
(async () => {
// retrieve table fields
let tableRead = {
method: 'GET',
url: `${baseUrl}/api/v2/meta/tables/${tableId}`,
headers: {
'xc-auth': authToken
}
}
let table = await nc_axios(tableRead, authToken);
// filter for fields that are long text
let fields = table.columns.filter(c => c.uidt === 'LongText');
// for each long text field, trigger update to convert to rich text field
for(let i = 0; i < fields.length; i++) {
let field = fields[i];
let updateField = {
method: 'PATCH',
url: `${baseUrl}/api/v2/meta/columns/${field.id}`,
headers: {
'xc-auth': authToken
},
data: {
...field,
meta: { richMode: true }
}
}
await nc_axios(updateField, authToken);
}
})().catch(err => {
console.log(err);
}); |
Hey @dstala, I tried to enable rich-text mode via the API as you suggested. (I'm using R, not JS, but it shouldn't matter). The Update Column API endpoint is quite peculiar. Although it's a
When I change the table owner in Postgres to the user I connect NocoDB with, the last request above runs fine but actually alters my DB table, changing its data type and dropping the NOT NULL constraint, which I obviously don't want. Is there a way to set Footnotes
|
Please confirm if feature request does NOT exist already ?
Describe the usecase for the feature
I really like NocoDB allowing to interpret
LongText
columns as Markdown aka "rich text". But it's tedious to enable it for every single text column in a database when you want to use the feature by default.Suggested Solution
It would be great if users could set a default for the Enable Rich Text column toggle globally per base.
The text was updated successfully, but these errors were encountered: